Forum Discussion
Question XLOOKUP finding the next match row if blank
- Oct 12, 2020
- KSolakFeb 20, 2025Copper Contributor
Hi Sergei, I'm trying to use the Xlookup method so that I can reverse the search order. It works in Excel, but not Google Sheets. I'm guessing it has to do with the way arrays are handled. Any thoughts?
- SergeiBaklanFeb 21, 2025Diamond Contributor
I'm not familiar with Google Sheets, but it looks like last-to-first works in it
- leanneypantsJul 03, 2024Copper Contributor
SergeiBaklan amazing, i used the second with the XLOOKUP and it worked.... i tried a ton of others including filters and what not. this worked!
- SergeiBaklanJul 03, 2024Diamond Contributor
leanneypants glad it helped, thank you for the feedback
- R_DunbarApr 24, 2021Copper Contributor
Thanks Sergei this has worked great for me also!
On the xlookup what does the &1 mean also &-- In the formula?
Cheers
Rich
- SergeiBaklanApr 24, 2021Diamond Contributor
Rich, glad to help.
Here (C2:C7<>"") returns an array with TRUE or FALSE. Double dash converts them to 1 or 0 accordingly, thus --(C2:C7<>"") returns an array with 1 for non-empty cells and 0 for empty ones.
By & we concatenate B2:B7 with this array (for example ="a" & "b" returns "ab"). Resulting array will be {"f11", "f2", "f21", "f3",...}.
=D3&1 returns text "f21". Finally we try to find this text in above array and return related value from C2:C7.
- jjanigaNov 06, 2020Copper Contributor
SergeiBaklan thank you so much. I have learned something new with this, brilliant!
- SergeiBaklanNov 07, 2020Diamond Contributor
Each of us learns something new on this resource, I'm not an exception. Anyway, glad to know it helped you, thanks for sharing.
- aussieCOct 12, 2020Copper Contributorthat's brilliant - thank you!
- SergeiBaklanOct 13, 2020Diamond Contributor
aussieC , you are welcome