Remove Text, Keep Numbers in a cell

leon6782

New Member
Joined
Apr 28, 2010
Messages
3
Hello,

I'm a bit of a newbie with Excel, but...

I have several cells with data that contain both letters and numbers (4H, 8V, 4FH, etc.) What I want to do is remove only the text characters from these cells, and add the remaining number values together among a series of cells with this data type.

If your answer involves using a macro or VB, please provide a link on how to use the formula. I've never used a macro or VB.

Thanks.
 
Try this. Again, this is a CSE formula.
Code:
=SUM(IF(ISERROR(VALUE(LEFT(A1:A5,1))),0,IF(ISNUMBER(VALUE(LEFT(A1:A5,2))),VALUE(LEFT(A1:A5,2)),VALUE(LEFT(A1:A5,1)))))

This will ignore any cell value where the 1st character is not a number. It will sum the cells where the 1st one or two characters are numbers.
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hi

Another option, also entered with CSE:

=SUM(0+(0&IF(LEFT(A1:A5)<="9",LEFT(A1:A5)&IF(MID(A1:A5,2,1)<="9",MID(A1:A5,2,1),""),"")))

... assuming the numbers have 1 or 2 digits and other possible characters are letters, as in the examples.
 
Upvote 0
Here's another formula. This is NOT as CSE formula...
Code:
=SUMPRODUCT(--(0&LEFT(A1:A5,ISNUMBER(LEFT(A1:A5,1)*1)+ISNUMBER(Left(A1:A5,2)*1)))*1)
 
Last edited:
Upvote 0
Hello,

I'm a bit of a newbie with Excel, but...

I have several cells with data that contain both letters and numbers (4H, 8V, 4FH, etc.) What I want to do is remove only the text characters from these cells, and add the remaining number values together among a series of cells with this data type.

If your answer involves using a macro or VB, please provide a link on how to use the formula. I've never used a macro or VB.

Thanks.


Copy and paste this.



if you need the col to be specific . Change ActiveSheet.UsedRange to (and this is an example) Range ("h:h")






Sub LiamObvSux()


With CreateObject("VBScript.RegExp")


.Global = True


.Pattern = "[^a-z]"



For Each LookIn In ActiveSheet.UsedRange


For Each Match In .Execute(LookIn)


LookIn.Replace What:=Match, Replacement:=""


Next


Next


End With


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,101
Messages
6,123,087
Members
449,095
Latest member
gwguy

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