ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Syntax HELP (https://www.excelbanter.com/excel-discussion-misc-queries/200778-syntax-help.html)

Eric H

Syntax HELP
 
I know this is wrong...
=if(G400,G40*$G$36,""),or(if(I400,I40*$I$36,"")o r(if(K400,K40*K36,"")


but what is the correct way to write an IF,OR statement?

Fred Smith[_4_]

Syntax HELP
 
It doesn't look to me like you want an Or condition. You want nested Ifs, as
in:
=if(G400,G40*$G$36,if(I400,I40*$I$36,if(K400,K4 0*K36,"")))

Regards,
Fred.


"Eric H" wrote in message
...
I know this is wrong...
=if(G400,G40*$G$36,""),or(if(I400,I40*$I$36,"")o r(if(K400,K40*K36,"")


but what is the correct way to write an IF,OR statement?



Don Guillett

Syntax HELP
 
Depends on what you want. This checks g40 and if 0,g40*g36. If not then
checks i40 and then checks k40.
Is this what you want?
=IF(G400,G40*G36,IF(I400,I40*I36,IF(K400,K40*K3 6,"")))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Eric H" wrote in message
...
I know this is wrong...
=if(G400,G40*$G$36,""),or(if(I400,I40*$I$36,"")o r(if(K400,K40*K36,"")


but what is the correct way to write an IF,OR statement?



smartin

Syntax HELP
 
Eric H wrote:
I know this is wrong...
=if(G400,G40*$G$36,""),or(if(I400,I40*$I$36,"")o r(if(K400,K40*K36,"")


but what is the correct way to write an IF,OR statement?


Hi Eric,

Well, the way to do OR is a little backwards in my opinion, but it goes
like this:

=OR(condition 1, condition 2, etc...)

This will return TRUE or FALSE.

But I don't think that's what you are trying to do. So forget about OR
for now.

IF can be used to make choices, like "IF..ELSEIF" by nesting. The
general form of IF is

=IF(condition, value if TRUE, value if FALSE)

This can be expanded to make choices as follows:

=IF(condition 1, value if true, IF(condition 2, value if true,
IF(condition 3, value if true, default value)))

You can nest IF like this for a few levels. I don't recall how many
because I seldom do this (it gets quite tricky to edit and maintain
after 2 or three levels).

I leave it to you to think about your formula, but here are some hints.
You are making three tests (G400, etc.) How are these prioritized? The
highest priority decision goes in the first condition of your nested IF.

Eric H

Syntax HELP
 
Thanks to all. It was helpful and got me on my way.

"smartin" wrote:

Eric H wrote:
I know this is wrong...
=if(G400,G40*$G$36,""),or(if(I400,I40*$I$36,"")o r(if(K400,K40*K36,"")


but what is the correct way to write an IF,OR statement?


Hi Eric,

Well, the way to do OR is a little backwards in my opinion, but it goes
like this:

=OR(condition 1, condition 2, etc...)

This will return TRUE or FALSE.

But I don't think that's what you are trying to do. So forget about OR
for now.

IF can be used to make choices, like "IF..ELSEIF" by nesting. The
general form of IF is

=IF(condition, value if TRUE, value if FALSE)

This can be expanded to make choices as follows:

=IF(condition 1, value if true, IF(condition 2, value if true,
IF(condition 3, value if true, default value)))

You can nest IF like this for a few levels. I don't recall how many
because I seldom do this (it gets quite tricky to edit and maintain
after 2 or three levels).

I leave it to you to think about your formula, but here are some hints.
You are making three tests (G400, etc.) How are these prioritized? The
highest priority decision goes in the first condition of your nested IF.



All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com