Encoding categorical data

learningstatistics

Board Regular
Joined
Dec 3, 2015
Messages
56
I encoded my nominal variables and I need to fill them out in a column. In other words, here is a table that shows a certain class and its corresponding code.

Acura0.01186
Aston Martin0.004237

<tbody>
</tbody>

I have 100 different types of cars in the table above with each car having it's own code.


I have a column that has data in this fashion and I need to fill out the code for the car (based on the table above). How do I do that?

Acura (( should be code for Acura))
Aston Martin((Code for Aston Martin))
Aston Martin((Code for Aston Martin))
BMW...
Cadillac
Chevrolet
Chrysler

<tbody>
</tbody>

If I use if functions this will take forever. What is the most efficient way of doing this?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
In B2 enter and copy down:

=VLOOKUP(A2,CodeTable,2,0)

where CodeTable is a 2-column table like the upper exhibit you posted.
 
Upvote 0
Thanks for your reply.

I do it but I am getting #N/A for some of the classes I am searching for. Any suggestions?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,734
Members
448,987
Latest member
marion_davis

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