Link to home
Start Free TrialLog in
Avatar of upobDaPlaya
upobDaPlaya

asked on

Adding a comma within a text string based on a condtion

I have a column of text.  Within the column for some cells I have embedded numbers.  My goal is if I find a cell where a space is found between two numbers I want to add a comma.  An example is below.  My thought was to use the InStr function within VBA (I already have an existing loop that goes thru the column), but this function only seems like a solution if I wanted to add a comma once I found a space.  However, I ONLY want to add a comma if a space is found within the string AND if the space is found between 2 numbers.

Current
JinDandy
Favor18 500Bye
Chuckwagon100 000sick
JeffMandy

Desired
JinDandy
Favor18,500Bye
Chuckwagon100,000sick
JeffMandy
SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of upobDaPlaya
upobDaPlaya

ASKER

Both approaches make sense - I used the reg solution