I am trying to do Vlookup inside an Array formula in Google Sheets.
I have two sheets, S1 and S2.
Each has 3 identical columns, Col A (Date), Col B(Name) and Col C(Payment-Type)
I would like to read the payment type from sheet 2 into sheet 1 based upon date and name combination match. Meaning if the date and name matches in sheet 2, return the Payment Type.
Here is my Vlookup formula,
=VLOOKUP(A2,FILTER('S2'!A2:C7,'S2'!A2:A7 = A2,'S2'!B2:B7 = B2),3,FALSE)
Above formula explained:
S1 is sheet 1 and S2 is sheet 2
A2 <- Date from sheet 1
'S2'!A2:C7 <- Entire sheet 2 range
'S2'!A2:A7 = A2 <- Comparing sheet 2 dates with Date in A2 of sheet
1
'S2'!B2:B7 = B2 <- Comparing sheet 2 names with Name in B2 of sheet
1
3 <- Returning the third column value which is Payment Type if the
date and name match.
This works well. Here is a link to the spreadsheet with an example:
https://docs.google.com/spreadsheets/d/1tIlq_kBWlM1Stj_Iqoua2LswW2IUl7TBbhnFFhPX4uo/edit?usp=sharing
I would like to replace the Vlookup formulas on all rows with just one Array formula in the second row.
This is what I have now which is not working.
=ARRAYFORMULA(VLOOKUP($A$2:$A$7,FILTER('S2'!A$2:C$7,'S2'!$A$2:A7 = $A$2:$A$7,'S2'!$B$2:B7 = $B$2:B7),3,FALSE))
Please, can someone tell me what is wrong here? I am pretty poor with these formulas. Kindly refer the sheet I attached above. That will explain everything to you.
Remove all contents of column C and then enter in C1
={"Payment Type"; ARRAYFORMULA(IF(LEN(A2:A), VLOOKUP($A2:A&B2:B,{'S2'!$A$2:A7&'S2'!$B$2:B7, 'S2'!$C$2:C7},2,FALSE),))}
See if that works?
Related
Using Google Sheets, I have a reference sheet with names along the Header and 3 values below each.
On the primary sheet, I want to have a name input in cell B8 and a formula in C12 to take that name and lookup in sheet 'Range' for the 3 values but return the highest value of the 3.
Here is the shared sheet: HighValueTest google sheet
Once I have that value (between 1 and 5) I want to highlight a column of cells representing the count of that value.
Any help greatly appreciated!
Here's a formula to copy it down for that max values of your heroes:
=MAX(INDEX(Range!$B$2:$4, 0, MATCH(B8, Range!$B$1:$1, 0)))
And here is the formula for conditional formatting for that indicator rows (apply to the range B2:B6):
=MAX($C$21:$C$23) >= (5 - ROW() + ROW($B$2))
$C$21:$C$23 here is just the range where we've put our max values before.
I have these sheets on Google Sheets
Sheet "Alpha"
A B C D
1 Date 03/11 03/12 03/13
2 Status DONE DONE In Risk
Sheet "Beta"
A B C D
1 Date 03/11 03/12 03/13
2 Status DONE DONE DONE
Sheet "Gamma"
A B C D
1 Date 03/11 03/12 03/13
2 Status DONE In Risk BLOCKED
I want to make a summary sheet with result on daily based as below:
Let's suppose today is 03/13
Sheet "Summary"
A B
1 Name Status
2 Alpha In Risk
3 Beta DONE
4 Gamma BLOCKED
I want to populate the column A using script or function.
So, the step on my mind would be:
Populate column A with script/function
On column B using formula for:
Finding the Today date on other sheet
Get value of the row on the column from today date from other sheer
Is it possible to do? How to do it?
In Sheet "Summary"
Finding by name in Column A
Cell B2: =HLOOKUP(TODAY(),INDIRECT(A2&"!$1:$2"),2,0)
Cell B3: =HLOOKUP(TODAY(),INDIRECT(A3&"!$1:$2"),2,0)
Cell B4: =HLOOKUP(TODAY(),INDIRECT(A4&"!$1:$2"),2,0)
Finding by Sheet
Cell B2: =HLOOKUP(TODAY(),Alpha!$1:$2,2,0)
Cell B3: =HLOOKUP(TODAY(),Beta!$1:$2,2,0)
Cell B4: =HLOOKUP(TODAY(),Gamma!$1:$2,2,0)
Function References
HLOOKUP
In Google Sheets for inventory management, sheet1 is stock in which Product and Quantity are mentioned, sheet2 is the sale of the day. I want to automatically deduct stock when a product is written over there, if apple is sold, then it should automatically deduct one quantity from sheet1.
The sheet is here.
Some code like this:
function onedit(sheet2,A2) {
if the product in Sheet2!A2 is in Sheet1!A2:A,Subtract 1 from Sheet1!B2:B
}
In your cell B2, you can insert this formula:
= 4 - SUM(QUERY(sold!$A$1:B,
"select count(A)
where A = '" & A2 & "'
group by A", false))
Then, you can drag it down to let the formula apply to all your rows.
The formula counts the number of occurrences in the "sold" sheet of the term in the column A of the first sheet. The QUERY function returns a table with one column and two rows (header and data). the SUM is applied to it, and reduces the QUERY result to a single number.
As with all formulas, results are kept up to date by the Google sheet automatically.
Instead of having the initial inventory in the formula itself, I suggest to use a separate column, for example column C. The formula above would then start with C2 instead of 4.
We have a Google Sheet doc which contains a date column with each date as a row value, and also multiple columns (some of which have the same name) and we want to sum the values in the cells where the row is a specific date, and the column has a specific header. For example where the date is 01/03/2017 we want to sum all the values which have the column header "X" on that date. Can this be done?
Yes it can be done
=SUMIF($C$3:$J$3,"X",OFFSET(C3:J3,MATCH(B1,B4:B15,0)+3,0))
Broken down
=sumif($C$3:$J$3 [<-header row with X],"X" [<-what we're looking for],C3:J3 [<-row to sum])
the formula above will sum the header row if there is an "X" (not very useful)
I used offset(C3:J3,[row number],0) with the header row range to push it down to the row matching 01/03/2017
To get the row number of 01/03/2017 I used Match() and put 01/02/2017 in cell B1
MATCH(B1,B4:B15 [range of dates] ,0)
I add 3 becuase my range starts at 4
You can hard code the date into the formula by replacing B1 with
DATEVALUE("01/03/2017")
I've not tried this in Google Sheets as I don't have access at the moment but it works in Excel and I'll try it in Sheets later.
Here's the formula that you can paste into A2 on your sheet "Sum of Data"
=SUMIF(Data!$B$1:$J$1,B$1,OFFSET(Data!$B$1:$J$1,MATCH($A2,Data!$A$2:$A,0),0))
It's all about changing the original formula to match your data and also locking the ranges correctly with the $ so that it will autofill down and across without breaking.
Use INDEX to peel off the appropriate column for SUMIF.
=SUMIF(A:A, G4, INDEX(A:E, 0, MATCH(H4, 1:1, 0)))
Considering a sheet where:
Cell B1 contains the date of interest (e.g. 01/03/2017)
Cell B2 contains the header of interest (e.g. X)
Cell B3 returns the sum of interest (values of all columns with header "X" on 01/03/2017)
Row 4 contains the headers to be evaluated (e.g. "Date", "A", "B", "X", "C", "X", "D")
Subsequent rows contain the actual data (e.g. dates in column A and data in columns B:G)
Refer to the image on the link below for details:
Example with cells of interest highlighted in yellow
The following formula should return the expected result:
=SUMIF(4:4,B2,INDEX(A:G,MATCH(B1,A:A,0),0))
I used Google Sheets in Portuguese. So, the formula actually tested was:
=SOMASE(4:4;B2;ÍNDICE(A:G;CORRESP(B1;A:A;0);0))
I hope that was usefeul.
In google docs I am tryignt to take the values from a column in one sheet and use them as column headings in another sheet without duplicates.
Thus if sheet1 has
a
a
b
f
g
g
Sheet 2 should have it as
a b f g
In Excel I would just use VBA code, how do I do it in a google sheets?
I know the command to get it into a column, but not into a row
=unique(sort('Acumen Lead Tracker'!X3:X64,1,true))
Thanks
Try in Cell A1 of the second sheet:
=transpose(unique(Sheet1!A:A))
where Sheet1 is the sheet where the values you want to use as headers are found in col A.