Concatenate Four Columns With Seperators

  • Thread starter Thread starter Stephen A. Gye
  • Start date Start date
S

Stephen A. Gye

Hi,

I have a spreadsheet with four columns, each of which may or may not have
data in them, that I would like to combine into one single string. Each
column that has data in it needs to be seperated by a "-". The possible
scenarios that I can think of are listed.

DRG_LINE1 - DRG_LINE2 - DRG_LINE3 - DRG_LINE4
DRG_LINE1 - DRG_LINE2 - DRG_LINE3
DRG_LINE1 - DRG_LINE3 - DRG_LINE4
DRG_LINE1 - DRG_LINE2 - DRG_LINE4
DRG_LINE1 - DRG_LINE2
DRG_LINE1 - DRG_LINE3
DRG_LINE1 - DRG_LINE4

DRG_LINE2 - DRG_LINE3 - DRG_LINE4
DRG_LINE2 - DRG_LINE3
DRG_LINE3 - DRG_LINE4
DRG_LINE2 - DRG_LINE4
DRG_LINE2
DRG_LINE3
DRG_LINE4

NOTHING AT ALL


I assume that I can do this some with some ID, AND and CONCATENATE
functions, but was ondering if someone had already done something like this
that they would be willing to share?

Thanks,
Steve
 
=A1&IF(B1<>""," _ "&B1,"")&IF(C1<>""," _ "&C1,"")&IF(D1<>""," _ "&D1,"")

--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top