Question description:
This user has given permission to use the problem statement for this
blog.
Hello. I need to assign 5 categories a number and was hoping to use a lookup function to make it easier for me (would like A-E to be associated with #1-5)
Solved by F. Y. in 20 mins
This is the chat thread from the real Excelchat help session. It contains no private user
information.
User
25/04/2018 - 01:50
this is excel 2010
Excelchat Expert
25/04/2018 - 01:50
Hello, I understand that you would like to assign categories to numbers using a lookup function.
Excelchat Expert
25/04/2018 - 01:50
Before we proceed, this is a reminder that our policy is 1 question per session so for this session we'll be resolving this particular question.
User
25/04/2018 - 01:50
in one tab I have two columns, one with 5 categorical variables and one blank that I would like to fill with assigned numbers for each variable. I have a separate tab listing the variable by number
User
25/04/2018 - 01:50
okay sounds good
Excelchat Expert
25/04/2018 - 01:51
If you are able to upload your file, I'd be able to giv e you a more accurate solution.
User
25/04/2018 - 01:51
I'd rather not - proprietary info
Excelchat Expert
25/04/2018 - 01:51
Otherwise, I'd just have to create a sample file you can use but you'll have to adjust it yourself.
User
25/04/2018 - 01:51
that's fine
Excelchat Expert
25/04/2018 - 01:52
Please see the formula in B2. It look at the value in column A then compares that to your lookup table in Sheet2.
Excelchat Expert
25/04/2018 - 01:53
The lookup value in Sheet2 can then be adjusted according to your needs.
User
25/04/2018 - 01:54
I'm not sure about the last variable, the blue
User
25/04/2018 - 01:54
what to put there
User
25/04/2018 - 01:54
right now I have vlookup(X2, tab array
Excelchat Expert
25/04/2018 - 01:55
There are a total of 4 parameters in a vlookup.
Excelchat Expert
25/04/2018 - 01:55
The first one is the value you are looking for.
Excelchat Expert
25/04/2018 - 01:55
The second one is where it will look for.
Excelchat Expert
25/04/2018 - 01:55
The third one is the column where the result will come from.
Excelchat Expert
25/04/2018 - 01:55
The last one is either 1 or 0. Just use 0 for exact match.
User
25/04/2018 - 01:56
what do you mean by where the result will come from?
User
25/04/2018 - 01:56
like why is "2" for B2
Excelchat Expert
25/04/2018 - 01:56
=vlookup(A2,Sheet2!A:B,2,0)
Excelchat Expert
25/04/2018 - 01:56
Let's break it down.
Excelchat Expert
25/04/2018 - 01:56
A2 is what you are looking for.
Excelchat Expert
25/04/2018 - 01:56
Sheet2!A:B is where it will look.
User
25/04/2018 - 01:56
what is the "2" though
User
25/04/2018 - 01:56
not the A2
Excelchat Expert
25/04/2018 - 01:57
2 is the column it will return as a result. In here, 2 means the 2nd column in Sheet2!A:B
Excelchat Expert
25/04/2018 - 01:57
So if you use Sheet2!A:D as the table array, you can write 3 to return column C, or 4 to return column D.
Excelchat Expert
25/04/2018 - 01:58
If you use Sheet2!B:E then 2 will return column C because column C is the 2nd column in B,C,D,E
User
25/04/2018 - 01:58
got it thank you
Excelchat Expert
25/04/2018 - 01:58
You are welcome. I'm glad to have helped!
Excelchat Expert
25/04/2018 - 01:59
Would there be anything else that I can help you with regards to the original question?
User
25/04/2018 - 01:59
nope that's great - thank you!
Excelchat Expert
25/04/2018 - 01:59
Alright, if you have no other questions regarding the original concern, I'd appreciate a 5-star rating and your feedback if you think I deserve it.
Excelchat Expert
25/04/2018 - 01:59
I'll be giving you high ratings as well so the other experts will know that you are a good client and should be taken care of.
Excelchat Expert
25/04/2018 - 01:59
Please do not forget to click the End Session button otherwise I'll be stuck here until the timer expires and be unable to help others. Thank you.
This is the output file from the real Excelchat help session:
This is an example of the expert help you can get. It contains no private user
information.