+ Reply to Thread
Results 1 to 7 of 7

Return Two Results if Condition in IF statement is true

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Chicago, IL
    MS-Off Ver
    Office 365
    Posts
    35

    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)

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    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),"")
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    Chicago, IL
    MS-Off Ver
    Office 365
    Posts
    35

    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

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    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"))
    Last edited by Special-K; 08-19-2019 at 08:46 AM.

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    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.

  6. #6
    Registered User
    Join Date
    08-17-2012
    Location
    Chicago, IL
    MS-Off Ver
    Office 365
    Posts
    35

    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.

  7. #7
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    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.
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Return False or True with condition
    By stev_2109 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2019, 09:26 AM
  2. [SOLVED] If Statement Only to Return True Results
    By Hannah122392 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-10-2016, 02:25 PM
  3. [SOLVED] Return multiple Results from an IF statement if more than one condition exists
    By mysticmoron109 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-28-2015, 02:45 PM
  4. IF STATEMENT returns False, even though the results are true
    By Biolu527 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-28-2013, 11:21 AM
  5. [SOLVED] RE: If condition is true return sumproduct of two arrays
    By Duke Carey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-14-2005, 01:05 AM
  6. [SOLVED] If condition is true return sumproduct of two arrays
    By Felipe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-14-2005, 01:05 AM
  7. [SOLVED] My If statement results in False when actually true
    By papa jonah in forum Excel General
    Replies: 7
    Last Post: 03-17-2005, 08:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1