#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default IF statement syntax

What is the proper syntax for a non-nested, two-condition IF statement?

Example: IF(C16<1 & C151,-B15).

This syntax appears to work when the two elements of the condition are
simultaneously true. Unfortunately, -B15 is apparently always returned, even
when the two conditions are not simultaneously true. What up? How do I get
this right?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,059
Default IF statement syntax

"Sander" wrote:
Example: IF(C16<1 & C151,-B15).


That should be written:

=if(and(C16<1, C151), -B15, "")

Note that I added "" to cover the case when the condition is not met. You
might replace "" with something else. But if you omit that part, the IF
function will return FALSE, which is usually undesirable.


----- original message -----

"Sander" wrote in message
...
What is the proper syntax for a non-nested, two-condition IF statement?

Example: IF(C16<1 & C151,-B15).

This syntax appears to work when the two elements of the condition are
simultaneously true. Unfortunately, -B15 is apparently always returned,
even
when the two conditions are not simultaneously true. What up? How do I
get
this right?

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default IF statement syntax

If true -B15 if false blank

=IF(AND(C16<1,C151),-B15,"")

If this post helps click Yes
---------------
Jacob Skaria


"Sander" wrote:

What is the proper syntax for a non-nested, two-condition IF statement?

Example: IF(C16<1 & C151,-B15).

This syntax appears to work when the two elements of the condition are
simultaneously true. Unfortunately, -B15 is apparently always returned, even
when the two conditions are not simultaneously true. What up? How do I get
this right?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default IF statement syntax

=IF(AND(C16<1,C151),-B15,"whatever answer you want if your condition isn't
met")
--
David Biddulph

"Sander" wrote in message
...
What is the proper syntax for a non-nested, two-condition IF statement?

Example: IF(C16<1 & C151,-B15).

This syntax appears to work when the two elements of the condition are
simultaneously true. Unfortunately, -B15 is apparently always returned,
even
when the two conditions are not simultaneously true. What up? How do I
get
this right?

Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default IF statement syntax

Try it like this:

=IF(AND(C16<1,C151),-B15,"")

If C16 is an empty cell it will evaluate to be less than 1. If you don't
what that to happen:

=IF(AND(C16<"",C16<1,C151),-B15,"")


--
Biff
Microsoft Excel MVP


"Sander" wrote in message
...
What is the proper syntax for a non-nested, two-condition IF statement?

Example: IF(C16<1 & C151,-B15).

This syntax appears to work when the two elements of the condition are
simultaneously true. Unfortunately, -B15 is apparently always returned,
even
when the two conditions are not simultaneously true. What up? How do I
get
this right?

Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA syntax dhstein Excel Discussion (Misc queries) 3 March 13th 09 12:53 PM
if statement syntax help OfficeManager Excel Worksheet Functions 6 July 23rd 08 08:09 PM
need help with syntax of if statement Melody Excel Worksheet Functions 3 February 15th 08 05:05 PM
when writing an IF statement what is the syntax for "Not Equal to. NEEDTOKNOW Excel Discussion (Misc queries) 1 December 10th 04 04:45 PM
when writing an IF statement what is the syntax for "Not Equal to. NEEDTOKNOW Excel Discussion (Misc queries) 1 December 10th 04 04:32 PM


All times are GMT +1. The time now is 04:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"