VLookup arranged into cell based on neighbor cell - google-sheets

I am looking for a way to do a VLookup that will call information from Google Sheet 2 into Google Sheet 1. Specifically, if cell H in 'Google Sheet 1' matches cell A in 'Google Sheet 2', it will put the information from cell B in 'Google Sheet 2' into the corresponding row in 'Google Sheet 1'.
Example is below:
Before function:
Google Sheet 1:
H I
1 Eng#1 (Blank)
2 Eng#2 (Blank)
3 Eng#3 (Blank)
4. ENG#4 (Blank)
Google Sheet 2:
A B
1 Eng#1 .4
2 Eng#2 .1
3 Eng#4 .7
4. Eng#7 .3
5. Eng#3 .2
Result I am seeking:
Google Sheet 1:
H I
1 Eng#1 .4
2 Eng#2 .1
3 Eng#3 .2
4. Eng#4 .7
5. Eng#7 .3
I would very much appreciate assistance with this, as it would be a way to increase efficiency and tracking for a group of people.

It sounds like you need to combine VLOOKUP and IMPORTRANGE. Try something like:
=ArrayFormula(IF(H:H="",,VLOOKUP(H:H,IMPORTRANGE("SheetKey","Sheet1!AB:AC"),2,0)))
Note that it may be necessary to try the IMPORTRANGE on its own first, to ensure that the Sheets have the correct access to each other.

It sounds like you need is an IF statement which you can then drag down vertically to all of column H -
=IF(H1=Sheet2!A1,Sheet2!H2,"")
You can copy and paste it to H4,H6,H8 etc and the cell references will change for you
if you are matching H1 against any row of column A use
=VLOOKUP(H1,Sheet2!A$1:A$100,2,false)
dragging this vertically will keep it referring to cells A1:A100 in Sheet2 but it can be copied/pasted to different cells horizontaly (cell references will change for you)

Related

auto ranking of rows when new data is added to sheet

I have a Google sheet (sheet A) that gets fed from another sheet (sheet B). I am trying to auto-rank the rows when new data gets added to sheet B. 
In the provided example screenshot (Example below), I use a formula for the "Points" column (M). All it does is if Column L has a value of 1 then assign 7 points, if the value is 2, then assign 5 points, and if the value is 3 then assign 3 points. All others get 1 point. So every new row is added - the points are automatically assigned.
={"Points";arrayformula(IF(L2:L="",,IF(L2:L=1,7,IF(L2:L=2,5,IF(L2:L=3,3,1)))))}
The Rank column (L) uses the formula =RANK(K2, K:K).
I want a similar formula similar to points formula that ranks each of the new rows based on the Points.
I tried this formula but it does not work -
={"Rankings";arrayformula(IF(K2:K="",,IF(K2:K>1,RANK(K2, K:K))))}
Any help is appreciated.
Example Screenshot
you can try this in Column L
={"Rank";BYROW(K2:K,LAMBDA(ax,IF(ax="",,RANK(ax,K2:K))))}

Google Sheets - How to retrieve a value from a range in one sheet to use in a formula on another sheet?

In Sheet A I have something like the following:
Apples
Oranges
Grapes
Bananas
15%
20%
25%
40%
228
304
380
608
In Sheet B I have the following:
Price
Apples
Oranges
Grapes
Bananas
$0.15
formula
formula
formula
formula
$0.72
formula
formula
formula
formula
In Sheet B, where I have written "formula" above, I want to have a formula that takes the value in the "Price" column for that row and multiples it by the corresponding percentage value for the header from Sheet A. For example, in the first "formula" in Sheet B under Apples I would have =A2*('SheetA' vLookup 'Apples' A2:Z2)
In this particular example I would expect the result to be $0.15*0.15=0.0225. Using the same formula, Sheet B should result with:
Price
Apples
Oranges
Grapes
Bananas
$0.15
0.0225
0.03
0.0375
0.06
$0.72
0.108
0.144
0.18
0.288
Edit for additional detail: The formula must search the header in the first sheet range because the positions in Sheet A are not static and may change. So for example, today the "Apples" percent may be Sheet A, B2 and tomorrow it may be in Sheet A, D2. It will always be in the same row (2), but not always in the same column. It will always have the same header in both sheets, so as long as it finds "Apples" in Sheet A, the next cell in row 2 will be the correct percent.
Try using the following in SheetB!B2:
=HLOOKUP(B$1, SheetA!$A$1:$2, 2, FALSE)*$A2
You'll actually want to use HLOOKUP instead of VLOOKUP, since you're searching a row horizontally instead of a column. You can then drag/copy the formula to all the relevant cells on SheetB.
here's an arrayformula approach:
=index(A7:A8*VLookup(B6:E6,split(flatten(A1:D1&"❆"&A2:D2),"❆"),2,0))
any reason why not use:
=ARRAYFORMULA(A2:D3*A7:A8)
update:
=INDEX(A6:A7*HLOOKUP(B5:E5, A1:D2, 2, ))

How to copy every 3 rows down (2 row cell with formula and 1 blank cells) for the next formula just go for 1 cells instead of go for 3 cells

I'm trying to copy 2 rows of formula and 1 blank row to fill down my required row, but when I'm trying to do that the formula in next row jump 3 cells, I want it so the next formula I paste just the next cell
Link to sheet:
https://docs.google.com/spreadsheets/d/1VAhls2rzaAJZiiRA-Z0Q2MusfCa8v1YoD1n2NxaCwzQ/edit?usp=sharing
sorry for my very terrible way of describing my problem, because I'm rarely using English for coding Q&A
all you need is this I guess:
=ARRAYFORMULA(SUBSTITUTE(TEXT(REGEXREPLACE(TO_TEXT(TRANSPOSE(
SPLIT(TEXTJOIN( , 1, TRANSPOSE(QUERY(TRANSPOSE(QUERY(
{IF('2019'!D2:D=0, "♥", '2019'!D2:D*0.0001),
IF('2019'!G2:G=0, "♥", '2019'!G2:G*0.0001)},
"select Col1,Col2,'♦ ♠' label '♦ ♠'''")), , 500000))), " "))),
"♦|♠|♥", ""), "0.0000"), "0.0000", ""))
if you need to output real number then wrap it after ARRAYFORMULA( into VALUE()
demo spreadsheet
The automatic alteration of formulas in Sheets when moving, copy-pasting, or drag-copying is not very sophisticated. It's also not configurable.
There may be more elegant workarounds, but I think the simplest thing to do is stop relying on it. If Sheets is bad at changing your formula, try a different formula that doesn't need to be changed in that staggered way. For example, A5 and A6 could be:
=if(INDIRECT("2019!D"&ROW()+1)=0,"",INDIRECT("2019!D"&ROW()+1))
=if(INDIRECT("2019!D"&ROW() )=0,"",INDIRECT("2019!G"&ROW() ))
This works because in A5 we want to refer to sheet 2019 row 6, so we use an INDIRECT reference to A5's row number (5) plus 1 (6).
When we're in A6, we instead want 2019 D6 and G6, so there's no adding 1.
If you can read my pseudo-formulas, your example sheet seems to follow the pattern:
  if 2019!D–next row = 0, output nothing, otherwise 2019!D–next row
  if 2019!D–this row = 0, output nothing, otherwise 2019!G–this row
  <blank cell>
Using the above formulas, if you select those three cells (formula, formula, blank), then drag-copying them keeps them working the way you wanted.

An if formula for multiple cells in another sheet

I have a google sheet that has 2 sheets, Sheet 1 with info in cells A and B.
I need to add a little formula in sheet 2, to check if any of the cells in sheet 1 column A (numbers) is bigger than the Numbers in column B cells, and then if so, say Yes else NO.
So IF in sheet1 any of the cells in Column A is bigger than in Column B, Then...."YES"
This checks on a row by row basis. If you want to know if ANY row in column A is bigger than in column B, that would be a bit different.
=if(Sheet1!A1>Sheet1!B1,"Yes","No")

Search the entire sheet and return an array of cell reference

Hi I am new to Excel/Google Spreadsheet.
I have a problem that I want to search the entire sheet for a given string.
For example the table looks like
A B C D
1 foo 1 bar 2
2 bar 9 abc 3
3 foo 2 bar 4
LOOKUP/MATCH/VLOOKUP can only search one row or column, I need a formula to search for the whole sheet for 'bar', and return the array of all found cells, e.g. {$C$1, $A$2, $C$3}.
What's more (the ultimate goal) is to calculated the sum of the numbers next to the found cells, in this example, 2+9+4=15.
I hope this can be achieved without VBA so that I can use the formula in Google Spreadsheet as well.
For your example, in Excel:
=SUM(IF(A1:C3="foo",B1:D3,0)) entered as an array formula, with ctrl-shift-enter
In Google:
=ARRAYFORMULA(SUM(IF(A1:C3="foo",B1:D3,0)))
The ranges can be as large as you like. The important points are that the first range covers all of the values you want to look for text in, and that the second range is the same size but shifted one cell to the right.

Resources