ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   FORMULA TO REMOVE TEXT FROM A CELL (https://www.excelbanter.com/excel-discussion-misc-queries/244355-formula-remove-text-cell.html)

Faraz A. Qureshi

FORMULA TO REMOVE TEXT FROM A CELL
 
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz

David Biddulph[_2_]

FORMULA TO REMOVE TEXT FROM A CELL
 
=IF(ISNUMBER(A1),A1,--LEFT(A1,FIND(" ",A1)-1))
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz




Per Jessen

FORMULA TO REMOVE TEXT FROM A CELL
 
Hi

Use this formula in a helper column, assuming 12 is a true value:

=IF(ISERROR(VALUE(A1)),VALUE(LEFT(A1,FIND("K"A1)-2))A1)

Regards,
Per

"Faraz A. Qureshi" skrev i
meddelelsen ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz



Rick Rothstein

FORMULA TO REMOVE TEXT FROM A CELL
 
I think this process give you what I think you ultimately want to end up
with. Select all the cells in the column from the first value to the last
value in the column (it is okay to select the mixture of cells with text and
cells with just numbers in them), click Edit/Replace from the menu bar, type
a space followed by and asterisk in the "Find what" field, leave the
"Replace with" field empty, then hit the "Replace All" button.

--
Rick (MVP - Excel)


"Faraz A. Qureshi" wrote in
message ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz



Faraz A. Qureshi

FORMULA TO REMOVE TEXT FROM A CELL
 
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz


"Rick Rothstein" wrote:

I think this process give you what I think you ultimately want to end up
with. Select all the cells in the column from the first value to the last
value in the column (it is okay to select the mixture of cells with text and
cells with just numbers in them), click Edit/Replace from the menu bar, type
a space followed by and asterisk in the "Find what" field, leave the
"Replace with" field empty, then hit the "Replace All" button.

--
Rick (MVP - Excel)


"Faraz A. Qureshi" wrote in
message ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz




Faraz A. Qureshi

FORMULA TO REMOVE TEXT FROM A CELL
 
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz


"David Biddulph" wrote:

=IF(ISNUMBER(A1),A1,--LEFT(A1,FIND(" ",A1)-1))
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz





Faraz A. Qureshi

FORMULA TO REMOVE TEXT FROM A CELL
 
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz



"Per Jessen" wrote:

Hi

Use this formula in a helper column, assuming 12 is a true value:

=IF(ISERROR(VALUE(A1)),VALUE(LEFT(A1,FIND("K"A1)-2))A1)

Regards,
Per

"Faraz A. Qureshi" skrev i
meddelelsen ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz




David Biddulph[_2_]

FORMULA TO REMOVE TEXT FROM A CELL
 
That'll need VBA, not a formula.
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz


"David Biddulph" wrote:

=IF(ISNUMBER(A1),A1,--LEFT(A1,FIND(" ",A1)-1))
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the
numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz







Per Jessen

FORMULA TO REMOVE TEXT FROM A CELL
 
Then, select the cells to be converted and run this macro:

Sub ExtractNumber()
Dim MyVal As Long
Dim n As Long

For Each cell In Selection.Cells
For n = 1 To Len(cell)
If IsNumeric(Mid(cell, n, 1)) Then
MyVal = MyVal & Mid(cell, n, 1)
End If
Next
cell.Value = MyVal
MyVal = 0
Next
End Sub

Regards,
Per

"Faraz A. Qureshi" skrev i
meddelelsen ...
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz



"Per Jessen" wrote:

Hi

Use this formula in a helper column, assuming 12 is a true value:

=IF(ISERROR(VALUE(A1)),VALUE(LEFT(A1,FIND("K"A1)-2))A1)

Regards,
Per

"Faraz A. Qureshi" skrev i
meddelelsen ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the
numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz





Faraz A. Qureshi

FORMULA TO REMOVE TEXT FROM A CELL
 
Mike H's following Array formula turned out to be great:

=MID(SUMPRODUCT(--MID("01"&A1,SMALL((ROW($A$1:$A$300)-1)*ISNUMBER(-MID("01"&A1,ROW($A$1:$A$300),1)),ROW($A$1:$A$300)) +1,1),10^(300-ROW($A$1:$A$300))),2,300)

--
Best Regards,

Faraz


"David Biddulph" wrote:

That'll need VBA, not a formula.
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz


"David Biddulph" wrote:

=IF(ISNUMBER(A1),A1,--LEFT(A1,FIND(" ",A1)-1))
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the
numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz







Rick Rothstein

FORMULA TO REMOVE TEXT FROM A CELL
 
Then you gave us bad examples because all your original examples showed a
number followed by text and indicated you wanted the number before the
space.

--
Rick (MVP - Excel)


"Faraz A. Qureshi" wrote in
message ...
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz


"Rick Rothstein" wrote:

I think this process give you what I think you ultimately want to end up
with. Select all the cells in the column from the first value to the last
value in the column (it is okay to select the mixture of cells with text
and
cells with just numbers in them), click Edit/Replace from the menu bar,
type
a space followed by and asterisk in the "Find what" field, leave the
"Replace with" field empty, then hit the "Replace All" button.

--
Rick (MVP - Excel)


"Faraz A. Qureshi" wrote in
message ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the
numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz





David Biddulph[_2_]

FORMULA TO REMOVE TEXT FROM A CELL
 
I thought you said that for 13.5 Kilogram you wanted the result to be 13.5?
Doesn't that formula return 135?
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
Mike H's following Array formula turned out to be great:

=MID(SUMPRODUCT(--MID("01"&A1,SMALL((ROW($A$1:$A$300)-1)*ISNUMBER(-MID("01"&A1,ROW($A$1:$A$300),1)),ROW($A$1:$A$300)) +1,1),10^(300-ROW($A$1:$A$300))),2,300)

--
Best Regards,

Faraz


"David Biddulph" wrote:

That'll need VBA, not a formula.
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz


"David Biddulph" wrote:

=IF(ISNUMBER(A1),A1,--LEFT(A1,FIND(" ",A1)-1))
--
David Biddulph

"Faraz A. Qureshi" wrote in
message ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the
numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz









Otto Moehrbach[_2_]

FORMULA TO REMOVE TEXT FROM A CELL
 
This macro, a slight modification of Per Jessen's macro to preserve the
period, will do that. HTH Otto
Sub ExtractNumber()
Dim MyVal As String
Dim n As Long
Dim cell As Range
For Each cell In Selection.Cells
MyVal = ""
For n = 1 To Len(cell)
If IsNumeric(Mid(cell, n, 1)) Or _
Mid(cell, n, 1) = "." Then
MyVal = MyVal & Mid(cell, n, 1)
End If
Next
cell.Value = MyVal
MyVal = 0
Next
End Sub
"Per Jessen" wrote in message
...
Then, select the cells to be converted and run this macro:

Sub ExtractNumber()
Dim MyVal As Long
Dim n As Long

For Each cell In Selection.Cells
For n = 1 To Len(cell)
If IsNumeric(Mid(cell, n, 1)) Then
MyVal = MyVal & Mid(cell, n, 1)
End If
Next
cell.Value = MyVal
MyVal = 0
Next
End Sub

Regards,
Per

"Faraz A. Qureshi" skrev i
meddelelsen ...
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz



"Per Jessen" wrote:

Hi

Use this formula in a helper column, assuming 12 is a true value:

=IF(ISERROR(VALUE(A1)),VALUE(LEFT(A1,FIND("K"A1)-2))A1)

Regards,
Per

"Faraz A. Qureshi" skrev i
meddelelsen ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the
numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz







All times are GMT +1. The time now is 10:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com