Share via

Help with separating data!

Anonymous
2024-12-14T06:07:50+00:00

Because the text to columns choice would only give limited choices as delimiters.  And I wanted to separate data as below.

2-Qatar358.27

4+1Bulgaria172.49

Like I want to separate the text and numbers appearing as text, and also to separate the “-“ and “+”.

Thanks in advance.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2024-12-14T11:23:10+00:00

    Link to a workbook on some file-sharing site (or onedrive or similar) with (plenty) more samples to separate and an example of some expected results (say for the more unusual ones).

    Was this answer helpful?

    0 comments No comments
  2. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2024-12-14T08:28:40+00:00

     So preferably I would not wish to use VBA.

    Okay, no problem, maybe someone else has an idea to accomplish this with a formula.

    Andreas.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-12-14T08:14:57+00:00

    I just follow the commands supplied to me, but honestly don’t understand a thing with respect to VBA.

    I would only rely on the macro commands supplied by the program.

    So preferably I would not wish to use VBA.

    Was this answer helpful?

    0 comments No comments
  4. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2024-12-14T07:47:29+00:00

    You are an experienced user, you know VBA, you know what a UDF is.

    Declare a variable InNumber as Boolean, if the first char of the text is a number or a dot InNumber is True. Declare a variable FromPos as Long, initialize with 1.

    For i=1 to Len(Text) , check if the char at the current position i is a number or dot, compare this with InNumber. If the result is the same, continue. Otherwise, copy the part from FromPos till the current position-1, set FromPos = current position and toggle InNumber.

    After the loop, i = Len(Text)+1, copy the part from FromPos till i-1 to grab the last part.

    IMHO that should work, what do you think?

    Andreas.

    Was this answer helpful?

    0 comments No comments