Concatenate Two Columns with a Dash, Skipping Some Blanks

JeremyS

New Member
Joined
Jul 24, 2015
Messages
9
Hello all,

I searched around on the forum for an answer for this, and I found some solutions that were close. I was not successful at adapting them to my needs (and I feel like this should be easy!).

I have a spreadsheet with testing data (quality control tolerances), so there is a column with the low limit of the testing specifications, and a column with the high limit of testing specifications. I want to be able to join to the two columns with a dash in between the numbers, so there is a single column showing the full range of quality control tolerances. Where the problem lies is sometimes the low range column is blank, sometimes the high range column is blank, and sometimes both columns are blank. The only time I need a dash is when both columns have some type of data. I've tried nesting IF and ISBLANK functions to no avail (they will leave blanks and concatenate when both cells in both columns are populated, but will leave a trailing or leading dash when one of the cells is filled and the other is blank). Here is a table with hypothetical data showing what the concatenate should look like, just so it is a little easier to see. It closely approximates the data I have. Thanks in advance for the help.

TestSpecificationRangeLowLimitHighLimit
7-979
00
11
0.0010.001
8-13813
0.005-0.250.0050.25
33
10-13.51013.5

<tbody>
</tbody>
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Good afternoon,

Just as a general solution I would think something along the lines of...

Code:
=CONCATENATE(A1,"-",B1)

Obviously change the column letter and row number to suit.

I hope this helps.
 
Last edited:
Upvote 0
=IF(OR(ISBLANK(B2),ISBLANK(C2)),B2&C2,B2&"-"&C2)

That will not give you -0 or 1-...

Good luck,

CN.
 
Upvote 0
Here is another formula for you to consider...

=SUBSTITUTE(TRIM(B2&" "&C2)," ","-")
 
Upvote 0

Forum statistics

Threads
1,215,401
Messages
6,124,705
Members
449,182
Latest member
mrlanc20

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