0
votes

In google sheets I have one sheet with a huge list of text messages. Each text message has a unique phone number.

In another sheet, I have a table of all phone numbers and a corresponding zero (female) or one (male).

I want the first sheet to have an additional column next to each text message with a 0 or 1 determined by a lookup with the second sheet.

What I've tried: I thought about using filter or match, but neither help me find the individual target cell being iterated over. Thanks for your ideas.

2

2 Answers

1
votes

Performing a vlookup seems to do what I ask for:

=VLOOKUP(C2, contact!$A$2:B5, 2, FALSE)

Edit: It's important to put False if you're doing a simple search. By default it's true and will select the closest-not-equal-to key, not matches.

Edit2: Added anchors to dictionary

1
votes

When it comes to joining data from different tables in Google Sheets, you can accomplish this quite efficiently by combining Arrayformula, Curly Brackets and Vlookup, and you only have to write this Join-formula in one cell.

To join data to your table of data with all the text messages, write this (in what I assume would be cell D2):

=ArrayFormula(
   {
     vlookup(C2:C, {contact!A2:A, contact!B2:B}, 2, false)
   }
)

I've written a guide about this topic called:
'Mastering Join-formulas in Google Sheets'