Reputation: 311
I have the following (sheet1):
State Region
South Australia Aberfoyle Park
New South Wales Abermain
South Australia Adelaide
And then (sheet2):
State Region Long Lat
Victoria Abermain -12.8167 51.4333
New South Wales Abermain -32.8167 151.4333
South Australia Aberfoyle Park -35.07 138.5885
I require an efficient way to search through sheet1
and match the Region
and State
in sheet2
, when a match is found I would like to create two new columns (in sheet1
) that copies the matched Long
and Lat
from sheet2
, the final output should look like (in sheet1
):
State Region Long Lat
South Australia Aberfoyle Park -35.07 138.5885
New South Wales Abermain -32.8167 151.4333
Note; sheet1 contains a lot of more data that is shown here so a simple copy past will not work :)
Thanks in advance.
Upvotes: 0
Views: 105
Reputation:
In Sheet1!C2 you could gather the correct data from two-column-matching records in several ways. Here are three scenarios and examples.
=iferror(index(Sheet2!C$1:C$9999, min(index(row($1:$9999)+((Sheet2!$A$1:$A$9999<>$A2)+(Sheet2!$B$1:$B$9999<>$B2))*1e99, , ))), "")
=sumifs(Sheet2!C:C, Sheet2!$A:$A, $A2, Sheet2!$B:$B, $B2)
=averageifs(Sheet2!C:C, Sheet2!$A:$A, $A2, Sheet2!$B:$B, $B2)
After putting any of those examples into Sheet1!C2 for the latitude fill right one column to pick up the longitude and then fill C2:D2 down to pick up all of the matches.
Upvotes: 1