Formula which extracts the last two numbers in a cell

Mr2017

Well-known Member
Joined
Nov 28, 2016
Messages
644
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi

I've got a formula which extracts the last two numbers in a cell and works correct if the cell says

2 for 23 but doesn't if the cell says

2for£23

Does anyone know how to fix this?

Please find below sample data which covers cells A1:B3.

The formula in cell B2 is =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100))

You can drag this down to cell B3 to get the result for B3. But the result in B3 should 23, like the result in B2.

Please let me know if you have any questions. TIA

[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Mechanic[/TD]
[TD="class: xl64, width: 64"]Y[/TD]
[/TR]
[TR]
[TD]2 for 23[/TD]
[TD]23[/TD]
[/TR]
[TR]
[TD]2for£23[/TD]
[TD]2for£23[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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