Search code examples
google-sheetsindexinggoogle-sheets-formulamatchgoogle-query-language

Imported data into Google Sheets, match and change one Column of Data


I have a google sheet that users input data on. These sheet has complete town names. Eventually the data they input gets uploaded into a program which has the town names abbreviated. Im looking for a way to automate basically doing find and replace.

Sheet1- Users input

Town Data
Washington Town Center 123345
Washington Town Center 988765
Fairland Heights 12345

Sheet2 - Reference to the correct names for program.

User Program
Washington Town Center Washington Twn Ctr
Fairland Heights Fair Heights

I basically need to replace the Town names in Sheet1 with the names the Program uses and then all data with that row. A new sheet worth of data is sent every week, so Im looking for the most efficient way to change those names.

I have tried using QUERY and FILTER but cannot seem to find the best way to go about this.QUERY would find all the matches and add as multiple rows as the user sheets can have multiple entries for same town

=QUERY('Sheet1'!A:G,"select * where A like '%"&A2&"%'",0)

Solution

  • you need VLOOKUP:

    ={INDEX(IFNA(VLOOKUP(Sheet1!A:A, Sheet2!A:B, 2, ))), Sheet1!B:G}