IF Formula

0

I am creating a spreadsheet to autocalculate my electricity account, but I have a problem with an IF formula which currently is written as follows:=IF(J2<D2,J2,IF(J2>D2,D2)). The first part works fine but the second part does nothing! Please help!

Answer
Discuss

Answers

0

The IF statement has 3 parts, like , IF( [Conditon], [If True], [If False] ). You have nested two IF statements, both of them without instruction what to do in case the conditon evaluates to False.

J2 can have three possible relations with D2. It can be larger, smaller or equal. So, a formula like this would make sense.

IF(J2>=D2, J2, D2)

Note that if J2 isn't equal and isn't larger then it must be smaller. So you don't need the second test for that. However, if you just want to extract the larger of the two it might be simpler to use the MAX function (or the MIN function to do the opposite).

=MAX(J2, D2)
Discuss

Answer the Question

You must create an account to use the forum. Create an Account or Login