Extracting numbers from at beginning of a string

Peter Davison

Active Member
Joined
Jun 4, 2020
Messages
451
Office Version
  1. 365
Platform
  1. Windows
I have the following string in Cell AO2
105 - Aylesbury
All I want is to take the first 3 numeric digits (105) and place it is cell AR2

I've tried all of the following 4 formulas

=RIGHT(TEXTJOIN("",TRUE,IFERROR((MID(AO2,ROW(INDIRECT("1:"&LEN(AO2))),1)*1),"")),3)
=LEFT(AO2,SUM(LEN(AO2)-LEN(SUBSTITUTE(AO2,{"0","1","2","3","4","5","6","7","8","9"},""))))
=SUBSTITUTE(TRIM(CONCAT(TEXT(MID(AO2,SEQUENCE(99),1),"0;;0; ")))," ",",")
=left(AO2,3)

and whilst they all extract 105 when my Vlookup uses the result its showing #N/A because I believe it still thinks its text.
When I do an F9 on the formula it shows the result like this - "105"

I've never had this problem before so I don't know what I am doing wrong.
Any thoughts?
Thanks for your time
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
How about
Excel Formula:
=left(AO2,3)+0
 
Upvote 0
Solution
That is perfect, it seems so simple, but I've never seen that before.
Thank you I've been on it ages.
Appreciate your help.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Just a quick separate question.
Sorry if I should send this in separately.
Do you know if I can show only the first legend (left hand bars) in a chart like the chart below?
1644852502643.png
 
Upvote 0
As this is a totally different question, it needs a new thread. Thanks
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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