excel question

Al Neri

Diamond Member
Jan 12, 2002
5,680
1
81
if i have a spreadsheet of

__a_b_
1 | a | 1 |
2 | b | 2 |
3 | c | 3 |
4 | d | 4 |
5 | e | 5 |

how could i make off to the side if i put "d" in a cell off to the right like E4 ... it give me the corresponding number (in this case, 4)
 

NeoV

Diamond Member
Apr 18, 2000
9,504
2
81
use a vlookup instead, lookups aren't too great for large tables of data

=vlookup(d1, $a$1:$b$5,2,false)

that assumes that d1 is the cell you entered "d" into
the dollar signs allow you to copy the formula to other cells and not have the range of data you are looking at be changed
 

Traire

Senior member
Feb 4, 2005
361
0
0
Another thing to keep in mind is that neither lookup nor vlookup work well (or at all) if the data is not sorted numerically/alphabetically. If your data set is in a random order, and you dont want to or cant sort the columns, try using the match function instead.
 

NeoV

Diamond Member
Apr 18, 2000
9,504
2
81
vlookup works just fine in non-sorted databases, just make sure you use the 'false' tag in the last spot - if that is set to true, then it just returns the first close match it finds, but false forces it to find an exact match