1

I have a column of values that says White, Black, Red, Blue, etc. I would like that row to convert to the colours' ID instead of the colour name. For example, White will be 1, Black will be 2 and so on.

I have almost 20 such values of colours corresponding with their IDs and I've heard that nested IF statements in Excel doesn't go beyond 7 IFs. How can I populate that column with the values' IDs instead of the values themselves?

1
  • There is VLOOKUP(lookup_value,table_array,col_index_num,[range_lookup]) and INDEX(array,MATCH(lookup_value,lookup_array,[match_type]). Now you need to show the example of your data to get the exact formula. Commented Sep 15, 2016 at 12:37

1 Answer 1

2

Use the switch function (supports 126 values):

Example:

=SWITCH(A2,1,"Sunday",2,"Monday",3,"Tuesday",4,"Wednesday","No match")

Complete documentation: https://support.office.com/en-us/article/SWITCH-function-47ab33c0-28ce-4530-8a45-d532ec4aa25e

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.