Exclude certain text from formula result

drewberts

Board Regular
Joined
Sep 5, 2013
Messages
177
Office Version
  1. 365
Platform
  1. Windows
Hi all

I have the following in a table on one sheet

Col A Col B Col C
123 Acacia Road London NW1 3BD
456 Acacia Road London No Postcode
789 Acacia Road London SW7 6GH
000 Acacia Road London N/A
963 Acacia Road London NE34 ???

On another sheet I have a formula that simply strings each column data into a single text string e.g. (Col A, Col B, Col C) which results in the following:-

123 Acacia Road, London, NW1 3BD
456 Acacia Road, London, No Postcode
789 Acacia Road, London, SW7 6GH
000 Acacia Road, London, N/A
963 Acacia Road, London, NE34 ???

I'd like to add into the formula ways of excluding certain text strings in Column C (i.e. "No Postcode", N/A & anything "?" so the result ends up as:-

123 Acacia Road, London, NW1 3BD
456 Acacia Road, London
789 Acacia Road, London, SW7 6GH
000 Acacia Road, London
963 Acacia Road, London

Thanks
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try this...

Excel Formula:
=TEXTJOIN(", ",,A1,B1, IF(OR(C1=" N/A",C1=" No Postcode"),"",IF(ISERROR(SEARCH("~?",C1,1)=0),C1,"")))

Omits anything with an "?" as well as the "N/A" and "No Postcode"
 
Upvote 0
=TEXTBEFORE(A1&" "&B1&", " &C1,{", No Postcode",", N/A","?"},,,1)

Copy down.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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