Google Sheets Get The Value Matching Closest Date - google-sheets

I am working on Google Sheets and my data is Col A Date and Col B Item Name and Col C Item Rate.
I want to get item rate based on Item name but the rate should be nearest to a particular date entered by me. Check the below link of the sheet for better understanding.
https://docs.google.com/spreadsheets/d/16Zq-MFL0AMNRWpich2_woxwxxlciKPMOMrL_gfv1szE/edit#gid=0
Any help on above will be greatly appreciated.

Try, using query, sort (desc) and index
=index(query(A:C,"select A,C where B='"&G2&"' and A<=DATE'"&TEXT(F2,"yyyy-MM-dd")&"' order by A desc limit 1",0),1,2)
edit, with arrayformula
=iferror(arrayformula(vlookup(G2:G&"~"&F2:F,
ARRAY_CONSTRAIN(sort({unique(filter(B2:B,B2:B<>"")),unique(filter(B2:B,B2:B<>"")),sequence(counta(unique(B2:B)),2,0,0);B2:B&"~"&A2:A,B2:B,A2:A,C2:C},2,1,3,1),
count(A2:A)+counta(unique(B2:B)),4)
,4,1)))
or with a space in place of 0
=iferror(arrayformula(vlookup(G2:G&"~"&F2:F,
ARRAY_CONSTRAIN(sort({unique(filter(B2:B,B2:B<>"")),unique(filter(B2:B,B2:B<>"")),sequence(counta(unique(B2:B)),1,0,0),transpose(split(REPT(" ,",counta(unique(B2:B))),","));B2:B&"~"&A2:A,B2:B,A2:A,C2:C},2,1,3,1),
count(A2:A)+counta(unique(B2:B)),4)
,4,1)))

Related

G-SHEET lookup with multiple criteria horizontal and vertical

If you could help me finding a formula that would solve my problem that I've been searching for a solution a few days now
So in my "feuil 1" I have what I'm searching for according to multiple values
-the aircraft number
-data 1
-cell number
-exit date (the value that I'm looking for)
And in another sheet "LH Synthèse" (the database) I have the aircraft number and data 1 in the same row and the cell number that will give me the exit date according to a specific aircraft and data 1 is the column value
What I want to do with this spreadsheet is to have a formula that is going to give me the exit date (present in the sheet "LH Synthèse") according to the values that are in the column A, B, C in the sheet "feuil 1"
The link of the spreadsheet in case my description isn't clear enough
https://docs.google.com/spreadsheets/d/1W4jVDT4wiui5h7i9Sx9rptyLnExhQvn9ICEDTFyat0E/edit?usp=drivesdk
Thanks for your help in advance
What I tried:
Index and match function
Filter function
Vlookup
use:
=INDEX(IFNA(VLOOKUP(A2&B2&C2; SPLIT(FLATTEN('LH Synthèse '!A3:A100&'LH Synthèse '!B3:B100&'LH Synthèse '!C2:K2&"×"&'LH Synthèse '!C3:K100); "×"); 2; 0)))

Google Sheets formula find highest or average from different sheets based on name

Hello stackoverflow, i want to fill cell on Sheet B based on Sheet A data. i tried some guide "Max If (Max Value with Condition)" but its doesnt work give 0 (zero) value instead.
thank you
try:
=QUERY(SheetA!B:G; "select B,max(G),avg(G) where G matches '^[0-9]+' group by B")

INDEX MATCH formula Google Sheet returns N/A value

I have 2 sheets in Google Sheet
https://docs.google.com/spreadsheets/d/1uqTUjoT978AyNU7TeBfVbcWDQ_aAamC7d51UB8gdLBk/edit?usp=sharing
I am trying to get "ranking" value from previous day ranking sheet.
Currently I am shucked with INDEX MATCH formula to get data from previous date sheet (20210810-0:7).
Please have a look at "20210811-0:6" sheet row 24, the formula I made returns N/A value
I tried VLOOKUP and combinations of INDEX MATCH formulas but all failed.
I checked the content D column with D column in another sheet, all values returned "TRUE"
Please tell me my mistakes. I tried many combinations of below formula.
=INDEX('20210810-0:7'!A4:A29,match(D24,'20210810-0:7'!A4:G29,0))
Yellow highlight is mistake formula
Green is how it should show.
=FILTER('20210810-0:7'!$A$4:$A$29,'20210810-0:7'!$D$4:$D$29 = D24)
Paste this in B24, I think this is what you are looking for.

Formula to search for a matching item on two Google sheets and then fill in a third value if a match is found

I have two google sheets.
-Sales Sheet
-Goal sheet
On the sales sheet:
Column I has a list of items
Column J is blank
On the goal sheet:
Column A has a list of items
Column I has a list of values.
I need a formula to enter on the Sales sheet, which will search for the item listed in column I for a matching item on column A of the goal sheet.
When a match is found, it needs to take the value found in column I of the goal sheet and place it into column J of the sales sheet.
I've tried several formulas using MATCH but I just can't seem to get it to work. Any help would be sincerely and greatly appreciated!!
I tired this formula, but it seems to be filling in the value from column A instead of the corresponding value from column I. I know I'm missing a step here, but I don't know where to start:
=INDEX(IMPORTRANGE("[Sheet ID]","Page!I1:I500"),MATCH(A121,A1:A500,0))
I figured it out:
=INDEX(IMPORTRANGE("[sheet ID]","Goal-sheet!$I$2:$I$500"),MATCH(I5,IMPORTRANGE("[sheet ID]","Goal-Guide-Internal!$A$2:$A$500"),0))

Google query function

I am trying to return multiple records from a logbook into a final monthly statement... I'm using the query function but I do not get multiple records, it only displays the first match.
My sheets are from 1-31 for days of the month, then the last sheet labeled 717 is for Unit #717's monthly statement.
On Sheet 717, I would like to display information from sheets 1 through 31. Where column A=717, display values from columns B,C,D. Currently, it will only show me the first match. The amount column should show the corresponding rate for that row.
I hope my explanation is not confusing, any help is much appreciated. Thanks.
Here is a link to sample spreadsheet.
As you are concatenating the output of QUERY functions, you are actually performing an "array calculation", and you'll need use an "array calculation enabler", otherwise you will indeed only get the first applicable result.
=ArrayFormula(QUERY('1'!A3:G60;"select B where A=717")&QUERY('1'!A3:G60;"select C where A=717")&QUERY('1'!A3:G60;"select D where A=717"))

Resources