Search code examples
google-sheetsgoogle-sheets-formulamatchspreadsheetlookup

Partial match within MAP/ LAMBDA function


I have a formula that lookup data for a particular date and an ID. My issue is some cells have multiple IDs. So I'm trying to find a way to look for a partial match within my formula. Below is the formula I'm currently using.

=MAP(B2:B,C2:C,LAMBDA(bx,cx,IF(bx="",,IFNA(FILTER(FILTER(Data!B:G,EOMONTH(Data!B1:G1,0)=EOMONTH(INT(LEFT(cx,7)),0)),Data!A:A=bx)))))

I'm guessing the last part is the one that need to be changed ->

Data!A:A=bx

I usually use the below trick to get an approximate match, but it does not work in this case.

"*"Data!A:A"*" or "*"&Data!A:A&"*"

here is my sample for file to better undesrtand my issue: https://docs.google.com/spreadsheets/d/1BxZYj5CTUuOjcVBeDC_v6nlizoPakNHRTpAZgrOahEw/edit#gid=0


Solution

  • You can try with REGEXMATCH to find the text no matter its location:

    =MAP(B2:B,C2:C,LAMBDA(bx,cx,IF(bx="",,IFNA(FILTER(FILTER(Data!B:G,EOMONTH(Data!B1:G1,0)=EOMONTH(INT(LEFT(cx,7)),0)), REGEXMATCH (Data!A:A,bx))))))
    

    enter image description here