I am working with a nested statement - if n2=y, then apply this and if n2=n apply this, but there will be some cells in the n column that will be blank and I can't seem to figure out how to get them to return either a blank or a zero. Any help is appreciated.

Try these: =IF(N2="y",1,IF(N2="n",2,0)) for a Zero

=IF(N2="y",1,IF(N2="n",2,"")) for a BlankMIKE

Looked promising for a moment, however I couldn't get it to work Here is what I am working on. I don't have a lot of skill in excel, just cobbled together so it might not be the prettiest string:

=IF(E2="y",LOOKUP(D2,ALyesRate)*(G2/1000),IF(E2="n",LOOKUP(D2,ALnonRate)*(G2/1000)))

So I need it to return a 0 or blank if E2 is blank

Think about the arguments that an IF function uses: IF(

logical_test, [value_if_true], [value_if_false])Now let's look at your formula and break it down...

=IF(E2="y",LOOKUP(D2,ALyesRate)*(G2/1000),IF(E2="n",LOOKUP(D2,ALnonRate)*(G2/1000)))

The

logical_testfor your first IF is: E2="y"

Thevalue_if_trueis:LOOKUP(D2,ALyesRate)*(G2/1000)

Thevalue_if_falseis: IF(E2="n",LOOKUP(D2,ALnonRate)*(G2/1000))The

logical_testfor your second IF is: E2="n"

Thevalue_if_trueis:LOOKUP(D2,ALnonRate)*(G2/1000)

Thevalue_if_falseis: oh, wait, there is novalue_if_falsefor your second IF.Since you want a blank if E2 doesn't equal "y" or "n", add a

value_if_falsefor your second IF.""is the equivalent of "nothing" and will produce a blank cell.=IF(E2="y",LOOKUP(D2,ALyesRate)*(G2/1000),IF(E2="n",LOOKUP(D2,ALnonRate)*(G2/1000)

,""))Note: This formula will return an empty cell for

anyvalue other than "y" or "n" in E2.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

This worked like a champ. Better yet, you walked me through the steps so I learned how to do it myself the next time and how to read the formula. Thanks so much for the lesson.

Ask Your Question

Weekly Poll

Do you believe gaming is ready for Virtual Reality?

Discuss in The Lounge

Poll History