ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Getting the difference between a "negative" number and a positive (https://www.excelbanter.com/new-users-excel/449957-getting-difference-between-negative-number-positive.html)

Mike Cadena

Getting the difference between a "negative" number and a positive
 
Hi All,
I'm trying to get the difference between two cells. Example A1=500 B1=9999850. Trying to subtract A1-B1. The numbers are from a new mechanical counter that starts at 9999850 then goes up to 0 then its positive from then on. Trying to get the result of 650 not -9999350. =ABS(A1-B1) dosen't do it. It's killing me since its only a one time occurrence but its on multiple cells.

Mazzaropi

Mike Cadena, good evening.

Try to use this one:
=IF(A1<B1,A1+10000000,A1-B1)

Is it what you want?

joeu2004[_2_]

Getting the difference between a "negative" number and a positive
 
"Mike Cadena" wrote:
I'm trying to get the difference between two cells. Example A1=500
B1=9999850. Trying to subtract A1-B1. The numbers are from a new
mechanical counter that starts at 9999850 then goes up to 0 then its
positive from then on. Trying to get the result of 650 not -9999350.


You say that it "goes up to 0" from 9999850. I assume you mean it is
7-digit counter that goes from 9999850 to 9999851 to 9999852 ... to 99999999
to 0000000 to 0000001 ... to 9999850.

If so, then use either of the equivalent formulas:

=IF(A1<=B1, 10000000+A1-B1, A1-B1)
or
=A1-B1+10000000*(A1<=B1)

Thus, if A1 is 9999999, the count is 149 (9999999-9999850); and if A1 is
zero, the count is 150 (10000000+0-9999850).

Note that if A1 is 9999850, testing A1<=B1 instead of A1<B1 treats the
difference as 10000000, not zero. I think that makes sense.



All times are GMT +1. The time now is 08:19 AM.

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