simple excell math question

Associate
Joined
19 Jul 2006
Posts
1,847
I have 2 numbers that I want to compair im using this formular at the moment

=IF((E4+F4)<(G4+H4),1,-1)

which says if the sum of e4+f4 is greater than g4+h4 then in the cell put 1 otherwise put -1 which works fine.
But i want to expand on this i want it to be
if ((e4+f4) is larger than (g4+h4) by 10 then put 1 in the cell or
if ((ef+f4) is smaller than (g4+h4) by 10 put -1 in the cell
otherwise put 0

How do i do this in excel

TIA
 
Last edited:
You're probably getting into the realms of having a macro now.

If you want to do this purely in Excel, I'd do it this way:

Have a hidden cell (let's say Z4) which has
Code:
=SUM((E4+F4)-(G4+H4))
Then in your cell to display the 1 or -1:
Code:
=IF(Z4>10,1,IF(Z4<-10,-1,0))
That works in my head anyway :)

*edit*
Just tested - it works in excel 2003
 
Last edited:
Back
Top Bottom