You don't need VBA for this. The simple Lookup
formula will work. Use the Formula Wizard - click Formulas, then Lookup and Reference
, and follow the prompts to provide input.
For instance, given the following data:
A B
1 Pear 500
2 Apple 700
3 Banana 600
And the following lookup table:
J K
1 500 Cool
2 600 Very cool
3 700 Super cool
Insert the following formula into cell C1
=Lookup(B1, J1:J3, K1:K3)
and then copy it into C2
and C3
A B C
1 Pear 500 Cool
2 Apple 700 Super cool
3 Banana 600 Very cool