need only data

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
883
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Team,

I have data in various formate. can I get any formula to find only data. There will be % space on random data but I need only data i.e 32 data can be in single digit as well. (instead of 32 it can be 8 with all below condtion)

32%A, (%)
32%ab,
32AB, (No Space )
32 AB(only has Space)

Thanks in Advance.
Regards,
Sanjeev
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
T
Code:
Function GDATA(r As Range)
    Dim Rg, m As Object
        Set Rg = CreateObject("VBScript.RegExp")
        Rg.Global = True
        Rg.Pattern = "\d+"
            If Rg.Test(r) Then
                Set m = Rg.Execute(r)
                If m.Count = 1 Then
                    GDATA = m(0) * 1
                Else
                    GDATA = m(1) * 1
                End If: End If
End Function

Perfect Shot!!!!! :)

Thanks for your help on this.

Have a great day Mohadin..:)

Regards
Sanjeev
 
Upvote 0
try with (last rows should be 0.32 not 32 only)
Book1
BCD
2raw
332%A, (%)32
432%ab,32
532AB, (No Space )32
632 AB(only has Space)32
71CD DD1
8333%SX VV333
932%32
100.32%xx vb32
110.3232
Sheet1
Cell Formulas
RangeFormula
D3:D11D3=GDATA(Table1[@raw])


eg.
rawNumber
32%A, (%)32
32%ab,32
32AB, (No Space )32
32 AB(only has Space)32
1CD DD1
333%SX VV333
32%32
0.32%xx vb0.32
0.320.32

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Text = Table.TransformColumnTypes(Source,{{"raw", type text}}),
    TS = Table.AddColumn(Text, "Number", each Text.Select([raw],{"0".."9","."})),
    DecNumber = Table.TransformColumnTypes(TS,{{"Number", type number}})
in
    DecNumber
 
Last edited:
Upvote 0
try with (last rows should be 0.32 not 32 only)
Book1
BCD
2raw
332%A, (%)32
432%ab,32
532AB, (No Space )32
632 AB(only has Space)32
71CD DD1
8333%SX VV333
932%32
100.32%xx vb32
110.3232
Sheet1
Cell Formulas
RangeFormula
D3:D11D3=GDATA(Table1[@raw])


Yes!!! it Work sandy

But also I am looking forward to seeing at the excel formula function if it is possible.

Thank you sandyy for your hard work and help on thissss!!!


Regards,
Sanjeev
 
Upvote 0
try
Excel Formula:
=SUMPRODUCT(MID(0&B3,LARGE(INDEX(ISNUMBER(--MID(B3,ROW($1:$25),1))*ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)
but it doesn't work with decimals
 
Upvote 0
Solution
try
Excel Formula:
=SUMPRODUCT(MID(0&B3,LARGE(INDEX(ISNUMBER(--MID(B3,ROW($1:$25),1))*ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)
but it doesn't work with decimals

Sheer brilliance on display once again! Super happy get this functions.

Thank you so much for your hard work.

Really appreciate your work on this. :)

Regards,
Sanjeev
 
Upvote 0
But also I am looking forward to seeing at the excel formula function if it is possible.
Assuming the numerical part is always the first thing in the string like your examples then this formula should also work for you, including with decimals.
Further, this one will not fail if rows are subsequently added at the top of the sheet.

sksanjeev786.xlsm
BC
1
2raw
332%A, (%)32
432%ab,32
532AB, (No Space )32
632 AB(only has Space)32
71CD DD1
8333%SX VV333
932%32
100.32%xx vb0.32
110.320.32
Sheet1
Cell Formulas
RangeFormula
C3:C11C3=LEFT(B3,MATCH(TRUE,INDEX(ISERR(MID(SUBSTITUTE(B3,".",1)&"x",ROW(INDEX(A:A,1):INDEX(A:A,20)),1)+0),0),0)-1)+0
 
Upvote 0

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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