Text String Extraction

jbuchhorn

New Member
Joined
Oct 17, 2017
Messages
5
Hi,

I have two related issues regarding the extraction of a portion of a text string which can be noted as 1) and 2) below.

1) In the case where I have some example inputs of R6.300, R10.300 & N10.300, I would like to be able to extract the numerical value proceeding the capital letter - in the case of my examples: 6, 10, 10 respectively. I have managed to make it work for each individual case (either N or R) but would ideally like a consistent formula that works for both (note that the number proceeding the letter ranges from single to double digit values only).

2) In the case where I have some example input R8, R8a, R10, R10a, R10b, I would like to be able to extract the numerical value proceeding the capital letter and terminates at either the end of the text, or the lower case letter - in the case of my examples: 8, 8, 10, 10, 10 respectively. I have managed to make it work for each individual (no letter following the number, a following the number, b following the number) but would ideally like a consistent formula that works for both (note that the number proceeding the capital letter ranges from single to double digit values only).

Any help would be greatly appreciated.

Cheers,

Jack
 
Hi, based on this and the examples from post#1 here is another option.

Excel 2013/2016
AB
R6.300
R10.300
N10.300
R8
R8a
R10
R10a
R10b

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFF00]#FFFF00[/URL] , align: right"]6[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]10[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]10[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]8[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]8[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]10[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]10[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]10[/TD]

</tbody>
Sheet2

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B1[/TH]
[TD="align: left"]=IFERROR(MID(A1,2,2)+0,MID(A1,2,1)+0)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

This is perfect, exactly what I want! Would you mind explaining how the worksheet formula works?
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Would you mind explaining how the worksheet formula works?

Hi, if the MID(A1,2,2) can be coerced to a number using +0 then that is the result, else the result is the MID(A1,2,1) coerced to a number.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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