Search code examples
google-sheetsgoogle-sheets-query

Google Sheet - Searching within a range of cells


In Google Sheets, imagine the range A1:A10 having names of persons and the range B1:B10 having corresponding phone numbers. I have a phone number that I would like to search through range B1:B10, and if there's a match, then I would like to get the corresponding name of the person with that phone number.

I tried something like: =INDEX(A1:A10,MATCH(A4,B1:B10,0)), but it returns error "Did not find value in MATCH evaluation".

How do I do this?

EDIT: I've realised that the value in A4 cell is actually a number, whereas the values in range B1:B10 are all textual ones. That's probably why the MATCH evaluation fails.


Solution

  • This did the trick: =INDEX(A1:A10,MATCH(VALUE(A4),B1:B10,0)).