+ Reply to Thread
Results 1 to 16 of 16

Create different formulas based off of "Yes" or "No"

  1. #1
    Registered User
    Join Date
    06-27-2008
    Location
    exeter
    Posts
    30

    Create different formulas based off of "Yes" or "No"

    Guys,

    I have 35 columns all with either "yes" or "no" drop down list options, if a "yes" is picked I want it to calculate a formula i.e. A1*B1 but if a "no" is selected I want it to move onto the next "Yes" which will have a different formula i.e. D1*E1, this is repeated 35 times any idea how I can get this into one formula?

    Any ideas?

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Create different formulas based off of "Yes" or "No"

    a bit more info needed can they all be yes or no
    if it's say
    y
    n
    n
    n
    y
    y
    if any of the n's is picked they would go to the second last y
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    06-27-2008
    Location
    exeter
    Posts
    30

    Re: Create different formulas based off of "Yes" or "No"

    No it will stop once a yes has been hit.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Create different formulas based off of "Yes" or "No"

    sorry thts not clear whet should each of those n's look to do,also what happens if there isn't a y below them?

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Create different formulas based off of "Yes" or "No"

    ok here is my first attempt
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-27-2008
    Location
    exeter
    Posts
    30

    Re: Create different formulas based off of "Yes" or "No"

    Thanks I think I can adapt that, just one thing can you adjust the formula so when a "n" is selected it will simply just display a "0" instead of searching for the next "y".

    Hope that makes sense and thanks in advanced! True legend!

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Create different formulas based off of "Yes" or "No"

    Wouldn't that just equate to

    =IF(A2="N",0,E2)
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Create different formulas based off of "Yes" or "No"

    ah i just love unnecessary questions!

  9. #9
    Registered User
    Join Date
    06-27-2008
    Location
    exeter
    Posts
    30

    Re: Create different formulas based off of "Yes" or "No"

    Apologies, it sort of works but what I am trying to do is just use one cell to display the "Y" formula.

    For example on your spreadsheet B1 would be the cell that displayed the next Y formula found in the A column. So if we didnt have a Y until cell A5 then B1 would display 30, and if we didnt have a Y until A12 and all the previous A1,A2... were N then B1 would dispaly 156.

    Does that make sense now?

    thanks

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Create different formulas based off of "Yes" or "No"

    so you will only have on yes in the whole lot then? oh and include your excel version in your profile
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-27-2008
    Location
    exeter
    Posts
    30

    Re: Create different formulas based off of "Yes" or "No"

    Please see attached, hope that makes sense?
    Attached Files Attached Files

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Create different formulas based off of "Yes" or "No"

    ok this should do it
    Attached Files Attached Files

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Create different formulas based off of "Yes" or "No"

    Maybe this in D12 ...
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  14. #14
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Create different formulas based off of "Yes" or "No"

    Or try this in D12 ...
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drag/Fill Down

    This will multiply the preceding 2 values for each instance of "Yes", then sum them.
    Attached Files Attached Files
    Last edited by Marcol; 07-13-2012 at 09:50 AM. Reason: Increased range to cover 35 sets

  15. #15
    Registered User
    Join Date
    06-27-2008
    Location
    exeter
    Posts
    30

    Re: Create different formulas based off of "Yes" or "No"

    Martin that works a dream, one last thing how do I get the #N/A to return a 0 figure? #N/A obviously is returned when a Yes isnt in a sequence.

    regards

  16. #16
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Create different formulas based off of "Yes" or "No"

    see Marcol's post #13, mind you that's why i said you should include your excel version in your profile if you have excel>=2007
    use
    =iferror(INDEX(E12:Z12,MATCH("yes",E12:Z12,0)-1)*INDEX(E12:Z12,MATCH("yes",E12:Z12,0)-2),0)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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