# Return Two Results if Condition in IF statement is true

1. ## Return Two Results if Condition in IF statement is true

Hello, I thought this would be easier than I thought.

I have an IF statement that is working but now I want two things to happen if the statement is true. I want a formula in one cell and the value of another cell to change. I tried using AND(result1, result2) and all that gave me was a FALSE result. What am I missing? Thanks.

=IFERROR(IF(O8>(I8*0.9), I8*0.01, VLOOKUP(InstallerParticipants!\$C2,rng_MP4P,4,FALSE)),0)

=IFERROR(IF(O8>(I8*0.9), K8=1, VLOOKUP(InstallerParticipants!\$C2,rng_MP4P,4,FALSE)),0)  Register To Reply

2. ## Re: Return Two Results if Condition in IF statement is true

Second formula

=IFERROR(IF(AND(O8>I8*0.9,K8=1),VLOOKUP(InstallerParticipants!\$C2,rng_MP4P,4,FALSE),0),"")  Register To Reply

3. ## Re: Return Two Results if Condition in IF statement is true

Thank you for your response but this is not giving me the result I desire. (I'm getting all zeros.)

I'm trying to combine the 2 statements into one statement with the resulting formula looking something like this: (I've removed the IFERROR function to clean up the formula for analysis.)

=IF(O8>(I8*0.9), I8*0.01 AND K8=1, VLOOKUP(InstallerParticipants!\$C2,rng_MP4P,4,FALSE)) (this formula gives me an error in use of AND.)

Here's another way of me trying to explain it:
If (this formula is true), (use this formula in I8 and then change the value in K8), else do the vlookup formula.

Thank you. --patb  Register To Reply

4. ## Re: Return Two Results if Condition in IF statement is true

Cells can contain a formula or a value, NOT both.
If K8 contains a formula then just change the formula for your new result.
If K8 contains a value (that's been entered either by hand or VBA) then you need to use VBA to change it.

e.g.

I type 3 into K8.
If I want to change that to something else, I have to either type another value in or use VBA to change it.
I cant use a formula since the cell contains a value.

Or if K8 has a formula like this...
=IF(A1=1,"The weather is sunny","")
and I now want the result to be "rainy" if B1 is 1
I change it to
=IF(A1=1,"The weather is sunny",IF(B1=1,"The weather is rainy","Neither rainy nor sunny"))  Register To Reply

5. ## Re: Return Two Results if Condition in IF statement is true

"If (this formula is true), (use this formula in I8 and then change the value in K8), else do the vlookup formula."
You cant do that in one formula.

A cell cannot change another cell.
You have to think the other way around.

A cell EQUALS something, it's either the result of a formula or a value and as above if that cell you want to change contains a formula you have to change the formula.
If the cell contains a value you have to use VBA.  Register To Reply

6. ## Re: Return Two Results if Condition in IF statement is true

Actually, this is for a vba macro. I was just trying to use the code generator to do the work for me. I will go try and change that code. Thanks.  Register To Reply

7. ## Re: Return Two Results if Condition in IF statement is true

Best way to get help is to attach a sample file with typical data/format.
Explain the logic and enter some results [manually] to show desired results.  Register To Reply

There are currently 1 users browsing this thread. (0 members and 1 guests) 