Text = a number

P

Phil

I want to have a simple formula with text equaling a certain number
Light (text) = 1
Medium(text)=2
Heavy(text)=3
 
P

Peo Sjoblom

One way

=IF(A1="","",VLOOKUP(A1,{"Light",1;"Medium",2;"Heavy",3},2,0))

that means if you type in heavy it will return 3, if you meant the opposite
switch places between the text and the numbers
 
G

Gord Dibben

Phil

With text in A1 enter this in B1 =IF(A1="light",1,IF(A1="medium",2,3))

Gord Dibben Excel MVP
 
R

Ron Rosenfeld

I want to have a simple formula with text equaling a certain number
Light (text) = 1
Medium(text)=2
Heavy(text)=3

Perhaps:

=CHOOSE(A1,"Light","Medium","Heavy")

where your number is in A1?

Or, if you mean to type in Light, Medium or Heavy and have the number come up:

=MATCH(A1,{"Light","Medium","Heavy"},FALSE)

In both cases, you need to specify what you want to happen if A1 contains none
of the numbers (or words).


--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top