1

Using Google Sheets, I am trying to two compare two columns on Google Sheets, like the one below:

https://i.stack.imgur.com/bK1wd.png

Basically, I want to compare column A and B, basically, if a cell in column A is inside a cell in column B (the number is inside the URL), I want to return the matching column B value in column C. Is there an easy way to do this?

0

=ARRAYFORMULA(IF(LEN(A1:A), REGEXMATCH(B1:B&"", A1:A), ))

0


=ARRAYFORMULA(IF(LEN(A1:A), IF(REGEXMATCH(B1:B&"", A1:A), B1:B), ))

0


=ARRAYFORMULA(IF(LEN(A1:A), 
 IF(REGEXMATCH(B1:B&"", TEXTJOIN("|", 1, A1:A)), B1:B), ))

0

  • Thank you! Right now it only returns if the columns are aligned, is there to make the code work if for example the content of B1 was in B2 instead? – user222813 Jul 12 at 20:02
  • you mean like B column is offset by 1 row or B column contains mixed stuff that is not aligned anyhow with column A ? – user0 Jul 12 at 20:08
  • Yes that is the exact situation, B column contains mixed stuff that is not aligned anyhow with column A – user222813 Jul 12 at 20:23
  • @user222813 answer updated – user0 Jul 12 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.