?
Solved

Formula - insert space after each instance of a specific character

Posted on 2013-12-17
6
Medium Priority
?
265 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
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…

752 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