=if(count(search) formula

rakesh seebaruth

Active Member
Joined
Oct 6, 2011
Messages
303
Dear Guys

Any help on the below formula


=IF(COUNT(SEARCH({"MR","AND","MRS"},C2)),"Dear Sir/Madam"," ") it works well for example for
MR JACK SMITH AND MRS JACK SMITH. But for MR JACK SMITH only it does not work. If in cell c2 name is MR JACK SMITH then result shall be "Dear Mr"

thanks

rakesh
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
rakesh seebaruth, Good morning.

Try to use:
Code:
="Dear "& IF(ISERROR(SEARCH("AND";C2));IF(ISERROR(SEARCH("MRS";C2));IF(ISERROR(SEARCH("MR ";C2));"";"Sir");"Madam");"Sir/Madam")
Is that what you want?

Probably will appear a more elegant formule. hi hi hi

I hope it helps.
 
Upvote 0
rakesh seebaruth, Good afternoon.

Maybe your argument separator in the formula is a COMMA ( , ) instead of a semicolon ( ; )

As in your new example you included a new title, I adapted the formula to meet the new requirement.
Code:
="Dear "& IF(ISERROR(SEARCH("AND",A1)),IF(ISERROR(SEARCH("MRS",A1)),IF(ISERROR(SEARCH("MR ",A1)),IF(ISERROR(SEARCH("MISS ",A1)),"", "Miss"),"Sir"),"Madam"),"Sir/Madam")
Here's your model with the formula I suggested.

https://www.sendspace.com/file/2vqcn9

Hope this helps.
 
Upvote 0
Just enter and copy down:

="Dear "&IF(SUM(COUNTIFS(A2,"*"&{"mr ","mrs ","miss"}&"*"))=1,LOOKUP(9.99999999999999E+307,SEARCH({"mr ","mrs ","miss"},A2),{"Sir","Madam","Miss"}),"Sir/Madam")

where A2 houses a string like NUCK MR MOH IRS.
 
Upvote 0
Another way:

="Dear "&LOOKUP(MMULT(--ISNUMBER(SEARCH({" MISS "," MR "," MRS "}," "&C13&" ")),{1;2;3}),{1;2;3;4},{"Miss";"Sir";"Madam";"Sir/Madam"})

Markmzz
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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