Extract Only Numbers From Text String

skhanna

New Member
Joined
Jul 4, 2018
Messages
1
Hi,

This did work. However, it does not cater to cases where in we have decimal values (Float) in the cell. For example: INR0.001. For this, the formula results in 1.
B1: =SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW($1:$25),1))*
ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)
 

Ron Coderre

MrExcel MVP
Joined
Jan 14, 2009
Messages
2,302
Yes....the assumption in most of the suggested solutions is that the numbers are greater than or equal to zero. Decimal fractions can be an issue. If your example is your typical situation, this regular formula returns the first set of consecutive numbers from the test cell:
Code:
B1: =LOOKUP(99^99,--("0"&MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),ROW(1:10000))))
Something you can work with?
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,247
Office Version
365
Platform
Windows
Hi,

This did work. However, it does not cater to cases where in we have decimal values (Float) in the cell. For example: INR0.001. For this, the formula results in 1.
B1: =SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW($1:$25),1))*
ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)
Welcome to the MrExcel board!

It would be good to see a slightly larger set of your sample data and expected results as the best/simplest way to get your results may well depend on just how much variation there is in your actual data.
We can't tell from one example but in the trivial case where all your data was 3 letters followed by a number then the result could be obtained with
=REPLACE(A1,1,3,"")+0
Whereas if there could be quite varied text before and/or after the number then a more complex solution may be required.
 

Forum statistics

Threads
1,082,176
Messages
5,363,583
Members
400,752
Latest member
HamerTime7119

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top