Online tutorials have been USELESS for this seemingly simple issue

Copper Contributor

All I want to do is convert words to numbers in a dataset. For example, if I have a column that has variables labeled apples, oranges, and grapes, I want apples=1, oranges=2, and grapes=3.

CarlWTF_0-1685121484980.png

Any help would be greatly appreciated, and if there are actually videos or tutorials that address this, please let me know!! I have yet to find anything.

 

3 Replies

@CarlWTF 

SWITCH is one way to do it:

=SWITCH(A2:A9,"Apples",1,"Oranges",2,"Grapes",3)

@CarlWTF 

In B2:

 

=XLOOKUP($A2,$A$1:$A1,$B$1:$B1,MAX($B$1:$B1)+1)

 

Fill down.