Reputation: 17
I have 3 columns of data that I want to combine into the format AAAA.BB-CC
Columns A and B will always have values, but column C is optional. In that case, I want to ignore the blanks and have the result written as AAAA.BB
The problem I have with my formula as it is now, is that the "-" will always show, even if column C is blank
='Set-Up'!$B$4 &"." &[MMC Code] & "-"&[Sub MMC Code]
The AAA portion comes from a different sheet, and is the same value down the list.
Upvotes: 0
Views: 89
Reputation: 3802
Another option
=SUBSTITUTE(TRIM('Set-Up'!$B$4&"."&[MMC Code]&" "&[Sub MMC Code])," ","-")
Upvotes: 1
Reputation: 152505
use an IF()
='Set-Up'!$B$4 &"." &[MMC Code] & IF([Sub MMC Code]<>"","-"&[Sub MMC Code],"")
Upvotes: 2