google sheets - How do I use XLOOKUP for multiple criteria? - Stack Overflow
Excel formula like "XLOOKUP" does not function in google sheet - Google Docs Editors Community
Excel Adds XLOOKUP. Coming for Google Sheets?
How do I make XLOOKUP work in Google Sheets?
What is the XLOOKUP syntax in Google Sheets?
Can XLOOKUP pull data from another spreadsheet?
How is XLOOKUP different from VLOOKUP?
I have data in google sheets that looks like what I have below. I am trying to populate a value by referencing two cells, vertical and horizontal. I want the formula to return the figure where the horizontal and vertical reference points meet.
My Google Sheets formula looks like this =XLOOKUP(L6,Sheet1!A1:BB1,XLOOKUP(E58,Sheet1!A3:A78,Sheet1!B3:AE85,0,0,1))
However I keep getting an error - array arguments to xlookup are of different size. Is there a better way of doing this?
The source data and the documents with the formulas are in the same file but different worksheets.
The image below is just an example
It is usually easier to use filter(), like this:
=filter('Master Data'!D2:D9, C3 = 'Master Data'!A2:A9, C4 = 'Master Data'!C2:C9)
To answer the question, to do the same with xlookup(), you can combine columns into a compound key, as attempted by the formula in the question. To combine columns of multiple rows with the & operator, you need to wrap the expression in arrayformula(), like this:
=xlookup(
C3 & "→" & C4,
arrayformula('Master Data'!A2:A9 & "→" & 'Master Data'!C2:C9),
'Master Data'!D2:D9
)
See your sample spreadsheet.
you can even use the Multiple Criteria Boolean Expressions XLOOKUP functionality
=XLOOKUP(1,ARRAYFORMULA(('Master Data'!A2:A9=C3)
*('Master Data'!$C$2:$C$9=C4)),'Master Data'!D2:D9,,0)
Here is a simple example:
Here is the formula associated with the previous example:
=XLOOKUP(1,ARRAYFORMULA((A2:A3=F2) * (B2:B3=F3)),C2:C3)
The formula can be adapted from Excel, check: XLOOKUP with multiple criteria.
Remember that XLOOKUP finds the first match, if you have multiple matches, you need to join the result for example.