?
Solved

Tweaking a concatenated formula in Excel

Posted on 2014-10-14
4
Medium Priority
?
72 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
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‚Ķ

765 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