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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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