Peter A
Peter A

Reputation: 1

Excel if statement not returning the correct value

I am trying to write an if statement which excel returns value.

Here is the example

I wanted to sum a range of rows say A1:A25 and if the value of sum B1:b25 is less than A1:A25 return condition true, if not perform calculation.

=IF(G7:AT7>G8:AQ8,0,"-0.1*(SUM(Y14:AL14))+SUM(AO14:AQ14")

Above was my condition but the excel returns "Value"

Can any one here assist how to fix this formula?

Upvotes: 0

Views: 258

Answers (2)

vv01f
vv01f

Reputation: 372

  1. You use different Ranges in Text and Formular. Make it match.
  2. You need to calculate sums before you can compare. It may be easier in the beginning if you just do things step by step in other cells.

According to text it should be:

=IF(SUM(B1:B25)>SUM(A1:A25);TRUE();"other calculation")

more oversight you get by first doing sums in different cells…

[C1]=SUM(A1:A25)
[D1]=SUM(B1:B25)
[E1]=-0.1*SUM(Y14:AL14;AO14:AQ14)
[F1]=IF(D1<C1,TRUE(),E1)

after everythings works as you liek it, you can still merge, clean up and make it look nice.

Upvotes: 0

FDavidov
FDavidov

Reputation: 3675

You have several syntax errors.The formula should be:

= IF(SUM(B1:B25) < SUM(A1:A25) , true , -0.1 * (SUM(Y14:AL14) + SUM(AO14:AQ14)))

Upvotes: 1

Related Questions