A reverse VLOOKUP?

I'm trying to achieve the following in Google Sheets.

Context - these are exported bank statements.

I have a sheet of lookup values (string, category).

StringCategory
ABCCat1
DEFCat2
GHICat3

I have another sheet of data, in particular 1 column which is Description.

DescriptionAmount
THE ABC SHOP TXN:1234567100
THE ABC SHOP TXN:3456789200
DEFINITELY ANOTHER SHOP REF: 1293891500

The strings in the first sheet are to look up against as the Descriptions that contain both static and dynamic identifiers in the same column. In particular I need to assign that row a category based on the description against the sheet of regexes I have constructed so that I can do a pivot table against the data for reporting.

DescriptionAmountCategory
THE ABC SHOP TEXAS TXN:1234567100Cat1
THE ABC SHOP DALLAS TXN:3456789200Cat1
DEFINITELY ANOTHER SHOP HOUSTON REF: 1293891500Cat2

Ideally this would also be a ARRAYFORMULA.

I can't use a VLOOKUP because that's only works for a exact match.

I've also tried INDEX/MATCH but that causes issues if I try to put a REGEXMATCH inside the expression as I can't put in a range in the REGEXMATCH.

In a way I guess this is a reversed VLOOKUP but instead of finding a match on a target range, I want to find the row of first value that is contained within the source value.

1 Answer

You may try:

=map(A2:A,lambda(Σ,if(Σ="",,iferror(+tocol(index(if(search(E2:E,Σ),F2:F,)),3),"--"))))

enter image description here

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like