Forum menu
Excel - IF?
 

[Closed] Excel - IF?

Posts: 1110
Free Member
Topic starter
 

I'm looking to add a Column B which auto populates with categories Based upon keywords in column A. Eg red = Colour or six = Numbers.

Is IF the best way to do this? There will be tens of keywords per Category.

Column A is already populated when I receive it.

Thanks


 
Posted : 16/09/2021 2:04 am
Posts: 1115
Full Member
 

You need to make a list of ColA values and corresponding ColB values then you can create a lookup table elsewhere to refer to

You then use a function like VLOOKUP to search for values in ColA and return the answer in ColB

examples here


 
Posted : 16/09/2021 3:12 am
Posts: 0
Free Member
 

IF can work if there is a small number of categories, like 3, but if there are more then VLOOKUP or HLOOKUP would be easier.

I suspect you're going to have several colours and several numbers so VLOOKUP would work better.


 
Posted : 16/09/2021 9:28 am
Posts: 71
Free Member
 

A vlookup on a reference table is likely neater when you’ve got tens of possible answers; otherwise you get a very long nested if formula.

You say ‘keywords’, is the full value of column A what you’re looking for, or if it says “red coat” are you looking for the column B value based only on the fact it contains “red”?


 
Posted : 16/09/2021 9:30 am
Posts: 1110
Free Member
Topic starter
 

Thanks all.

njee20 - it'd be looking for keywords in a web address so Not exact match.


 
Posted : 16/09/2021 10:17 am
Posts: 71
Free Member
 

That has a bearing, and makes things significantly messier!


 
Posted : 16/09/2021 5:59 pm
Posts: 4209
Free Member
 

You can use wildcards in Vlookup, which should help match buried keywords.

=VLOOKUP("*"&value&"*",data,2,FALSE)

See https://exceljet.net/formula/partial-match-with-vlookup


 
Posted : 16/09/2021 6:28 pm