ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to add alphanumeric data? (e.g., 1C+2D) (https://www.excelbanter.com/excel-discussion-misc-queries/142105-how-add-alphanumeric-data-e-g-1c-2d.html)

[email protected]

How to add alphanumeric data? (e.g., 1C+2D)
 
I have a set of alphanumeric data. How do I add just numbers, leaving
letters behind?

For instance, 1X+2X+3X should = 6. Any suggestions?

Thanks!


Fred Smith

How to add alphanumeric data? (e.g., 1C+2D)
 
If you always have one digit to add, you can use:

=left(a1,1)+left(a2,1)+left(a3,1)

If you can have more than one digit, but only one letter, you can use:

=left(a1,len(a1)-1)+...

If you have something else, let us know.

--
Regards,
Fred


wrote in message
ups.com...
I have a set of alphanumeric data. How do I add just numbers, leaving
letters behind?

For instance, 1X+2X+3X should = 6. Any suggestions?

Thanks!




Gary''s Student

How to add alphanumeric data? (e.g., 1C+2D)
 
Try this UDF:

Function noname(r As Range) As Variant
v = r.Value
For i = 65 To 90
v = Replace(v, Chr(i), "")
Next
For i = 97 To 122
v = Replace(v, Chr(i), "")
Next
noname = Evaluate("=" & v)
End Function


use in worksheet like:
=noname(A1)
--
Gary''s Student - gsnu200719

Ron Rosenfeld

How to add alphanumeric data? (e.g., 1C+2D)
 
On 9 May 2007 05:52:33 -0700, wrote:

I have a set of alphanumeric data. How do I add just numbers, leaving
letters behind?

For instance, 1X+2X+3X should = 6. Any suggestions?

Thanks!


If you're strings might be more complicated than what you've posted, you could
download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

Then use this formula:

=EVAL(REGEX.SUBSTITUTE(A1,"[A-Za-z]"))


--ron


All times are GMT +1. The time now is 03:56 PM.

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