View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stan Brown Stan Brown is offline
external usenet poster
 
Posts: 524
Default If Statement Not Working

Fri, 11 May 2007 14:00:08 +0200 from papou
:

"Telegirl" a écrit dans le message de
news: ...
=IF(SUM(I14:I19)=(G20-H20),(G20-H20),"error")
It always returns 'error', even if the statement is true. Any
suggestions?


Try
=IF((SUM(I14:I19))=(G20-H20),(G20-H20),""error"")
Because Excel calculates formulas with priority standards starting with the
operation symbols (such as +, -)


But "comma" has quite low priority, so it is never necessary to
parenthesize function arguments. It is also never necessary to put
parens directly around a function call. Telegirl had enough
parentheses -- in fact, she even had two unnecessary sets.

=IF(SUM(I14:I19)=G20-H20,G20-H20,"error")

Telegirl,

You say "even if the statement is true". why not create a couple of
temporary "helper" cells, one containing sum(I14:I19) and the other
containing G20-H20, and change your IF to reference those cells? That
will help you see what is going on.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/