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

MechanicY
2 for 2323
2for£232for£23

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
How about
=TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(A3,"£"," ")," ",REPT(" ",100)),100))
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,346
Members
449,155
Latest member
ravioli44

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