Solved

Tweaking a concatenated formula in Excel

Posted on 2014-10-14
4
68 Views
Last Modified: 2014-10-14
I am using a simple formula in Column I to concatenate the values in Columns B, F, G & H and insert hyphens in between each string being concatenated. Sometimes there no values in Columns G & H, so the concatenated result ends up with a hyphen dangling at the end. Other times there are no values in B, F, G & H, in which case the concatenated results contains hyphens only. I would like to revise the formula to eliminate the dangling hyphen, and if there are no values, then have the cell remain blank.

I've attached a sample spreadsheet illustrating the existing formula + desired results.

Thanks!
Andrea
Sample-Concatenation.xlsm
0
Comment
Question by:Andreamary
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 500 total points
ID: 40380061
This formula (using the ampersand instead of CONCATENATE) should meet your requirements:
=B2&IF(F2<>"","-"&F2,"")&IF(G2&H2<>"","-"&G2&H2,"")

Regards,
-Glenn
0
 

Author Closing Comment

by:Andreamary
ID: 40380123
Perfect...thanks very much, Glenn!
Andrea
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40380131
You're welcome very much, Andrea. :-)
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40380169
Glenn,  

glad to see you back :-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question