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

N

namemattersnot

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!
 
F

Fred Smith

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.
 
G

Gary''s Student

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)
 
R

Ron Rosenfeld

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
 
Top