How do I attach a number to a cell with text to use in a formula?

G

Glen

I am trying to make a spreadsheet to allow for pricing. I have a dropdown box
in a cell with stock codes and I want to attach a cost to each code so I only
have to click on the code for it to be included in a formula. How can I have
the formula read a number(cost) from a text(stock code) cell?
 
T

T. Valko

Create a 2 column table with the code in the left column and the
correspsonding cost in the right column.

...........A..........B
1.....Code....Cost
2........X..........5
3........Y..........3
4........Z..........6

Let's assume your drop down list is in cell H1. From the list you select
code Y. To get the cost for code Y:

=SUMIF(A2:A4,H1,B2:B4)

Or

=VLOOKUP(H1,A2:B4,2,0)
 
Top