Seb
Seb

Reputation: 113

Change number in the cell to value from different cell, if it matches the number next to it

I have is bunch of .csv files, one of them is the main one where I have columns that look something like this:

main doc

These numbers should be changed to text value which can be found in different file like this one for the id_type:

id_type

So as you can see if in my main I have 199 in id_type column - it should look into the other document for number 199 and if found -> take what's in the cell next to it and bring back to the main document and replace 199 with "name199".

Upvotes: 0

Views: 107

Answers (1)

Alex Szabo
Alex Szabo

Reputation: 3276

You should use VLOOKUP() for this:

=VLOOKUP(B2;Sheet2.A2:B6;2;0)


VLOOKUP (V = Vertical) is a function that will do exactly as you described, the parameters are:

  • What value you wish to find (in this case B2 = 119)
  • Where is the data (in this case the other sheet's A:B range), it is important to note that the value you wish to find in the first step (B2) should be the left-most column of this range.
  • The nth column you wish the retrieve the data from. In your case, you want to return type name, which is the second column (therefore you put 2 in there) of the lookup range.
  • For the last parameter, you should put 0 if you are looking for exact matches (which you do now), and put 1 if you wish to find the closest value.

Upvotes: 2

Related Questions