Testing for a value that contains an ampersand

DerfNotwen

New Member
Joined
Mar 27, 2018
Messages
6
I'm converting a series of names from simple Joe Bloggs to joe.bloggs@whispers.com. No problem there
However, a couple of the names are odd and I have an If statement that I need to use to check them and do something different
=If(H1="Support",H1&"@whispers.com") - easy enough
The problem comes when the odd name contains an ampersand as the test removes it and concatenates the letters either side
If(H1="BP&D Suppliers Limited","Suppliers.Limited@whispers.com") fails as it tests for BPD Suppliers Limited

How do I test for "BP&D Suppliers Limited" please ?

I've tried imbedding Chr(38) in place of the ampersand, it comes back with ?Name

I'm sure there's a solution, but searching message boards/google hasn't revealed it

Thanks in advance
Fred
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
That would suggest H1 doesnt equal BP&D Suppliers Limited not that its testing for something else. What does this produce?

=LEN(H1)=LEN("BP&D Suppliers Limited")

and

=H1="BP&D Suppliers Limited"
 
Upvote 0
Solution
That would suggest H1 doesnt equal BP&D Suppliers Limited not that its testing for something else. What does this produce?

=LEN(H1)=LEN("BP&D Suppliers Limited")

and

=H1="BP&D Suppliers Limited"
thanks for the pointer, your hint about "doesn't equal BP&D Suppliers Limited" set me thinking about the cell format. Checking it showed General, I changed it to Text and, lo and behold, it worked

Thanks for the help
Regards
Fred
 
Upvote 0

Forum statistics

Threads
1,215,809
Messages
6,127,012
Members
449,351
Latest member
Sylvine

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