# Assign a number to a text string.

#### jimleslie77

##### New Member
In an excel spread sheet if I type in the word "work" in col a row b, can that automatically assign the number "8" to col b row b. If so how do I do this?

Thanks
Jim

### Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Like this?

in B2, enter =IF(A2="work",8,"")

Welcome to the board.

Not to sure what you mean by
col a row b
, but try setting B1 = IF(A1="Work",8,"") and copying the formula down.

Hi Jim

Welcome to the Board!

Just to expand on NBVC's suggestion, if you have multiple possibilities ie Work=8, Play=6, Hiking=10 etc then you might like to use VLOOKUP instead. Eg in B2:

=VLOOKUP(A2,\$D\$1:\$E\$3,2,0)

Where D1:D3 holds Work, Play, Hiking and E1:E3 holds 8,6,10.

Best regards

Richard

Ive been trying for ages to get this sorted, thanks so much to you all for all your help.

Replies
3
Views
171
Replies
3
Views
598
Replies
0
Views
169
Replies
0
Views
110
Replies
2
Views
139

1,214,321
Messages
6,118,886
Members
448,856
Latest member
Eduard_Stoo

### 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.

### Which adblocker are you using?

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

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