Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Formula - insert space after each instance of a specific character

Posted on 2013-12-17
6
Medium Priority
?
268 Views
Last Modified: 2013-12-17
I need to create a formula that looks at a given cell, finds all instances of a specific character, and does a substitute or replaement.

I need to have a formula that inserts a space after each comma....one that either replaces the "," with ", " or that just finds the comma and inserts a space.

For example:
    cell might show the following - First National Bank,Anytown,US,12345
    Needs to show as First National Bank, Anytown, US, 12345
0
Comment
Question by:IO_Dork
[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
6 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 39724796
=substitute(a1,",",", ")
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39724800
If you end up with commas followed by two spaces then try this

=substitute(substitute(a1,",",", "),",  ",", ")
0
 

Author Comment

by:IO_Dork
ID: 39724842
the amount of commas could and may vary...is there a formula to address this variability?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 50

Expert Comment

by:barry houdini
ID: 39724852
SUBSTITUTE will replace all the commas, so the number doesn't matter

You can address the double space issue with TRIM, i.e. amending Saqib's suggested formula like this

=TRIM(SUBSTITUTE(A1,",",", "))

regards, barry
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 39724906
CTRL+R
0
 

Author Closing Comment

by:IO_Dork
ID: 39724934
Thanks, worked perfectly with no extra spaces.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

610 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