Find the difference between two alphanumeric cells

titchestiny

New Member
Joined
Nov 3, 2013
Messages
20
Hi,

I'm trying to find the difference between two alphanumeric cells. For example:

CKP
11AB2BC1
22AB4BC+2
32AB5BC3

<tbody>
</tbody>

Conditions:
- The columns that I am comparing are not next to each other, nor do they start at A1.
- The letters in the cell do not need to be used.
- The answer needs to return an absolute value.
- The numbers always appear to the left of the letter string.

I've tried to use the IF, AND and FIND functions, and I was successful in returning a result for one row, but the formula wouldn't work for the remaining rows of data.

Any help you can give, would be most appreciated.

Thanks,

Tt

p.s. I'm using excel 2010
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Maybe this helps?
=LEFT(K3,1)-LEFT(C3,1)
=LEFT(K4,1)-LEFT(C4,1)
=LEFT(K5,1)-LEFT(C5,1)

<tbody>
</tbody><colgroup><col></colgroup>
 
Upvote 0
Hi,

I'm trying to find the difference between two alphanumeric cells. For example:

CKP
11AB2BC1
22AB4BC+2
32AB5BC3

<tbody>
</tbody>

Conditions:
- The columns that I am comparing are not next to each other, nor do they start at A1.
- The letters in the cell do not need to be used.
- The answer needs to return an absolute value.
- The numbers always appear to the left of the letter string.
You gave us very good information, but you forgot to include one detail.. what is the biggest number that can be in a cell? Assuming 999, give this formula a try..

=LOOKUP(999,--LEFT(C3,{1,2,3}))-LOOKUP(999,--LEFT(E3,{1,2,3}))

If you maximum number is different, you can adjust the red highlighted parts to account for the difference... you need as many 9's in the two 999 parts as there are digits in your maximum value and the two comma delimited lists must count from 1 to the number of digits in your maximum value. So, if your maximum value were, say, 50000, then the formula would be adjusted to this...

=LOOKUP(99999,--LEFT(C3,{1,2,3,4,5}))-LOOKUP(99999,--LEFT(E3,{1,2,3,4,5}))

If there will only be single digits in front of the text, then use the formula vogel997 posted above.
 
Upvote 0
Hi Rick,

Thanks for your post. Apologies that I left a piece of key information out. The data only includes a single digit, so I have used vogel997's formula.

I appreciate the time you took to post. I never considered using the LOOKUP formula to solve the problem.

Thanks for the help,

Tt
 
Upvote 0
Interesting formula.
How would you separate the letters from the numbers if the length varies? Lookup as well?
 
Upvote 0
This is really helping me as well. A quick question Rich, I have some negative values as well for eg -1AC or -40C. How do I deal with this.

A B
-40c 40c

How do I find the difference for this?

Thanks a ton for the help,
Vibin.
 
Upvote 0
Hi,

What would be your expected result for:

C3: -1AC
E3: -40C

Regards
 
Upvote 0
just to remind, as you mentioned you require absolute value, don't forget to be wrap the formula with =ABS() just in case the number in the 2nd column is less than that in 1st column...


Maybe this helps?
=LEFT(K3,1)-LEFT(C3,1)
=LEFT(K4,1)-LEFT(C4,1)
=LEFT(K5,1)-LEFT(C5,1)

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,433
Messages
6,124,863
Members
449,195
Latest member
MoonDancer

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