Home > OS >  Criteria to search and return
Criteria to search and return

Time:07-07

I have table1 (id, assetid) and table2 (id, assetid, lat)

In table1 I want to create a new column which does the following:

Looks for matching ‘assetid’ (matching table1 and table2) and then returns (from table 2) the ‘lat’ number.

I ended up with the following however this isn’t right

=IF((COUNTIF(table2!,)<0),,"")

CodePudding user response:

Try INDEX()/MATCH().

=INDEX($G$2:$G$4,MATCH(B2,$F$2:$F$4,0))

Below formulas should also work.

=VLOOKUP(B2,$F$2:$G$4,2,FALSE)
=XLOOKUP(B2,$F$2:$F$4,$G$2:$G$4,"")
=@FILTER($G$2:$G$4,$F$2:$F$4=B2)

enter image description here

  • Related