easier way to assign code to cell values

nikegeo

Board Regular
Joined
Jul 23, 2010
Messages
52
Hi all,

im wondering if there is an easier way to assign a "code" that references another cell based on its value:

I would like to assign the numbers 1-5 in column b for the following values (respectively): pitch won (1), pitch lost(2), pending (3), pitching (4), prospecting (5)

the formula i have now which does the job is:
=IF(AND(I2="Pitch Won"),"01",IF(AND(I2="Pitch Lost"),"02",IF(I2="Pending","03",IF(I2="Pitching","04",IF(I2="Prospecting","05","")))))

wondering if theres an simpler formula to do this (fyi - i paste data into a template that has these types of formulas & calculations)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try

=MATCH(I2,{"Pitch Won","Pitch Lost","Pending","Pitching","Prospecting"},0)
 
Upvote 0
wow thanks! much easier to look but my Match function experience is non-existent. Will surely read up on it!

Thank you for your quick response
 
Upvote 0
EDIT NOTE
==========
In rereading your question, it seems I gave you the wrong answer (mine goes from number to text whereas I now see you wanted to go from text to a number).

Another possibility...

=CHOOSE(I2,"Pitch Won","Pitch Lost","Pending","Pitching","Prospecting")
 
Last edited:
Upvote 0
You're right - I tried with other data and didnt get the result i was looking for in my template...
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,700
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top