Number between two commas.

anwaee2

Board Regular
Joined
Sep 13, 2012
Messages
153
Office Version
  1. 2011
Platform
  1. MacOS
I would like to be able to extract the numbers between two commas.
Example:
Extract the number any number between the third and fourth commas as getting the number 657 out of the number 12,657,358,623,100.

Again thanks to all for any help.
 
You can try the below :
Book1
AB
1First Comma3
2Second Comma4
3
412,657,358,623,100
5
6Result (Excel 2011)623
7Result (Excel 365)623
Sheet2
Cell Formulas
RangeFormula
B6B6=TEXT(SUBSTITUTE(TRIM(MID(SUBSTITUTE(A4,",",REPT(" ",LEN(A4))),(B1)*LEN(A4)+1,(B2*LEN(A4))-((B1)*LEN(A4))))," ", ","),"0")
B7B7=TEXTJOIN(",",,DROP(TAKE(TEXTSPLIT(A4,","),,B2),,B1))

Also note that the value between third and fourth commas is 623 and not 657
 
Upvote 0
Another option
Excel Formula:
=REPLACE(LEFT(A2,FIND("^",SUBSTITUTE(A2,",","^",4))-1),1,FIND("^",SUBSTITUTE(A2,",","^",3)),"")
 
Upvote 0
"Extract the number any number between the third and fourth commas as getting the number 657 out of the number 12,657,358,623,100."

The question stated number and the count of commas appears to be from the right.
To secure the requested 657 from the number try the following.
I used Fluff's approach on the text equivalent.

T202503a.xlsm
ABC
1Nnumbers not text365Excel 2011
212,657,358,623,100657657
352,223,334,448,888223223
4
5
2c
Cell Formulas
RangeFormula
B2:B3B2=--LET(a,TEXTSPLIT(TEXT(""&A2,"###,###,###,###,###"),","),INDEX(a,2))
C2:C3C2=REPLACE(LEFT(TEXT(""&A2,"###,###,###,###,###"),FIND("^",SUBSTITUTE(TEXT(""&A2,"###,###,###,###,###"),",","^",2))-1),1,FIND("^",SUBSTITUTE(TEXT(""&A2,"###,###,###,###,###"),",","^",1)),"")
 
Upvote 0
Thanks to all for the replies, You all were very helpful as usual. Thanks again.
Sorry, after testing it, I found it didn't quite do what I needed. My fault. I should have explained better what I was trying to do. I needed to pick out the thousands, millions or what ever no mater the length of the number such as getting 657 (billions) from 12,657,358,623,100 or 125,889,222,657,363,785,345.
 
Upvote 0
It is unclear whether the original data is actually numerical or text. Could be one of these.

25 03 07.xlsm
AB
1If Number
212,657,358,623,100657
3
4If Text
512,657,358,623,100657
Extract
Cell Formulas
RangeFormula
B2B2=--RIGHT(INT(A2/10^9),3)
B5B5=--LEFT(RIGHT(SUBSTITUTE(A5,",",REPT(" ",100)),400),100)
 
Upvote 0
Solution
no mater the length of the number
You mention number but give 125,889,222,657,363,785,345 as an example. Excel cannot deal with that as a number so if it is in a cell it must be text, in which case the second of my formulas above would extract the 657.

25 03 07.xlsm
AB
7125,889,222,657,363,785,345657
Extract
Cell Formulas
RangeFormula
B7B7=--LEFT(RIGHT(SUBSTITUTE(A7,",",REPT(" ",100)),400),100)
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top