How can I parse strings in Numbers on Mac?

I have a string that I want to parse. The seperator is the >


What is the best way to parse these into numbers?


R-P312>Z290>L21>S552>DF13>ZZ10_1>Z16423>Z255>L159>Z16429>BY519>ZZ7_1>BY17700>Y93172


[Re-Titled By Moderator]

iMac 27″, macOS 12.7

Posted on Mar 6, 2025 6:20 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 6, 2025 6:35 PM

If that is in cell B2 and you want to extract only the numbers to C2, D2, etc.

C2 =VALUE(REGEX.EXTRACT($B2,"\d+",COLUMN()−2))

Fill right


This assumes they will all be as shown in your string: whole numbers, no decimals, no thousands separators, no spaces between digits, etc. 10_1 will be a 10 and a 1. Two separate numbers. Same with 7_1. If you want a different result, say what it is. The "_" can be included as a character to be extracted along with the numbers if you want 10_1 (which is not a "number"). Or we can go one more step and turn it into 10.1


VALUE converts them from strings into actual numbers. Leading zeros, if any, will disappear. You don't need to use VALUE but, as strings, they will be ignored if used in any numeric functions (like SUM). You can use the math operators +-*/ but not the numeric functions.

9 replies
Question marked as Top-ranking reply

Mar 6, 2025 6:35 PM in response to Nicholas James

If that is in cell B2 and you want to extract only the numbers to C2, D2, etc.

C2 =VALUE(REGEX.EXTRACT($B2,"\d+",COLUMN()−2))

Fill right


This assumes they will all be as shown in your string: whole numbers, no decimals, no thousands separators, no spaces between digits, etc. 10_1 will be a 10 and a 1. Two separate numbers. Same with 7_1. If you want a different result, say what it is. The "_" can be included as a character to be extracted along with the numbers if you want 10_1 (which is not a "number"). Or we can go one more step and turn it into 10.1


VALUE converts them from strings into actual numbers. Leading zeros, if any, will disappear. You don't need to use VALUE but, as strings, they will be ignored if used in any numeric functions (like SUM). You can use the math operators +-*/ but not the numeric functions.

Mar 6, 2025 9:30 PM in response to Nicholas James

Now that I know what you want (everything between the >'s, not just the numbers), we can do it easiest with the TEXTBETWEEN function.


C2 =IFERROR(TEXTBETWEEN(">"&$B2&">",">",">",COLUMN()−2),"")

Fill right


I wrapped it in IFERROR in case these strings to be parsed are of different lengths. When TEXTBETWEEN runs out of matches, it throws an error. If they will all have the same number of items then you can leave that part off.

Mar 6, 2025 9:24 PM in response to Badunit

Ah, I believe you posted a 'text edit' option a long while back in another post on this subject.


Steps:

  1. open text edit.
  2. paste the text into text edit.
  3. type a 'tab'.
  4. copy the 'tab' into the cut buffer with a control C.
  5. Initiate Find/Replace with a command F and select the Replace tab
  6. Put the delimiter into the find box (in this case >)
  7. Paste the tab into the replace with a Command V
  8. Do a 'replace all'
  9. Copy the text and paste into numbers.


*How do we specify a tab without the cut and paste option?


Mar 6, 2025 8:13 PM in response to Badunit

This is messy, but it should work. Why does Apple make this so hard?


Row 1: sequential numbers 1,2,3

Row 2: length of string in cell to lower left =LEN(B4)

Row 3: Find the starting position of delimiter less 1 SEARCH(">",B4,start-pos)

Cell B4: Text to be parsed.

Row 4: Get the mid value of the string after the delimiter. MID(B4,SEARCH(">",B4)+1,C$2−C$3)

Cell A5: Count number of delimiters: COUNTMATCHES(B4,">")

Row 5: Get the left value of the cell. Use if statement to get the final cell IF(B$1>$A5,B4,LEFT(B4,C$3−1))



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I parse strings in Numbers on Mac?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.