Using IF function to insert information

lily231

New Member
Joined
Aug 15, 2017
Messages
5
I think its easier to just show you!

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Company[/TD]
[TD]Sector[/TD]
[/TR]
[TR]
[TD]LMArchitect[/TD]
[TD]Architect[/TD]
[/TR]
[TR]
[TD]PJKArchitects[/TD]
[TD]Architect[/TD]
[/TR]
[TR]
[TD]PLPlumber[/TD]
[TD]Plumber[/TD]
[/TR]
</tbody>[/TABLE]

I have a list of companies in column one. I want to include the sector in column two. However they are a mix of letters and types. Is it possible to use the IF function or something similar to say for example "IF architect present in A1 THEN write Architect in A2"

It will have to be able to detect architect when it is inside a word, and not standing on its own.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
[TABLE="width: 715"]
<colgroup><col><col span="9"></colgroup><tbody>[TR]
[TD]redarchitectblue[/TD]
[TD]architect[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bluearkitectred[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]this formula is used[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 5"]=IF(ISERROR(SEARCH("architect",A1)),"","architect")[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Hi, if you have a list of all possible sectors then you can try like this, for example:


Excel 2013/2016
ABCD
1CompanySectorList of Sectors
2LMArchitectArchitectArchitect
3PJKArchitectsArchitectPlumber
4PLPlumberPlumberCarpenter
5Baker
Sheet1
Cell Formulas
RangeFormula
B2=LOOKUP(1,-SEARCH($D$2:$D$5,A2),$D$2:$D$5)
 
Upvote 0
can you explain how your formula works please - especially the minus sign....

Hi, from the help for LOOKUP()..

If the LOOKUP function can't find the lookup_value, the function matches the largest value in lookup_vector that is less than or equal to lookup_value.

Because we can't necessarily know what number the SEARCH() function is going to return to the lookup_vector we turn those results negative. Then by using 1 as the lookup_value we can ensure that we get a match if appropiate.

You can get the same result by using a big lookup value instead, i.e.

=LOOKUP(9.99E+307,SEARCH($D$2:$D$5,A2),$D$2:$D$5)
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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