Excel - IF?
 

Subscribe now and choose from over 30 free gifts worth up to £49 - Plus get £25 to spend in our shop

[Closed] Excel - IF?

6 Posts
5 Users
0 Reactions
141 Views
Posts: 1106
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 1:04 am
Posts: 1108
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 2: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 8: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 8:30 am
Posts: 1106
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 9:17 am
Posts: 71
Free Member
 

That has a bearing, and makes things significantly messier!


 
Posted : 16/09/2021 4:59 pm
Posts: 4191
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 5:28 pm