Extracting a number in between characters

Capri

New Member
Joined
Jun 4, 2015
Messages
11
I have text in this format:

Filename , Pages:[1-4 digit number]/Rows:[1-4 digit number], Format, From: Name

The text is in A1 and I need to extract the 1-4 digit number in between the first colon and slash into B1 and the 1-4 digit number in between the slash and second colon into C1.

Any help would be highly appreciated. Thank you.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi.

In that example, the second number does not appear to be, as you say, "between the slash and second colon" (that position is occupied by the string "Rows"). Can you clarify?

Regards
 
Upvote 0
In that example, the second number does not appear to be, as you say, "between the slash and second colon" (that position is occupied by the string "Rows"). Can you clarify?
To add one more question to XOR LX's question... is the "filename" just the name of the file only or does it include the path (with its own slashes) as well?
 
Upvote 0
Hi.

In that example, the second number does not appear to be, as you say, "between the slash and second colon" (that position is occupied by the string "Rows"). Can you clarify?

Regards

Hi.

Sorry, I meant in between the second colon (after Row) and second comma.

Thanks.
 
Upvote 0
The filename has no slashes in it.
My guess is someone will post better formula, but until then, this will work... with text in cell A1, put this in cell B1 and copy it across to cell C1 (then copy the both of them down as required)...

=0+TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,"/",":"),",",":"),":",REPT(" ",200)),2*COLUMNS($B:B)*200,200))
 
Upvote 0
So are the numbers in question always preceded by the strings "Pages:" and "Rows:"?

Regards
 
Upvote 0
My guess is someone will post better formula, but until then, this will work... with text in cell A1, put this in cell B1 and copy it across to cell C1 (then copy the both of them down as required)...

=0+TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,"/",":"),",",":"),":",REPT(" ",200)),2*COLUMNS($B:B)*200,200))


Thank you for this, Rick.

How would I add a formula to ignore the cell (i.e. A1) if the cell were blank? For example, if A1 is blank, I get a #VALUE! in B1.
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,140
Members
448,551
Latest member
Sienna de Souza

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