+ Reply to Thread
Results 1 to 11 of 11

Variation on an IF formula

  1. #1
    Registered User
    Join Date
    03-07-2013
    Location
    San Antonio
    MS-Off Ver
    Excel 2010
    Posts
    45

    Variation on an IF formula

    Good afternoon,

    I am in need of a formula that will sum a different set of cells baased on the value in another cell. below is an example.

    Thanks in advance!

    sample WS.xlsx

  2. #2
    Forum Contributor
    Join Date
    12-11-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    232

    Re: Variation on an IF formula

    How does this feel?

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Variation on an IF formula

    There's got to be a better way..

    Is there more information in your actual sheet? Another column that might indicate if each value in the column is related to Plan A or Plan B ?

    Say if Column B = "Plan A" then Sum the corresponding value in Column A
    You can then use SUMIF
    =SUMIF(B:B,"Plan A",A:A)

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Variation on an IF formula

    This will work for you, based on your sample...

    =IF(B22="PlanA",B4+B6+B10,B13+B14+B17)

    However, if there is a specific code in A that you want to add together, you could probably use a sumif() function instead
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    03-07-2013
    Location
    San Antonio
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Variation on an IF formula

    Jonmo,

    Nemo74's formula works, and yes, I agree that your way would be much easier, however the problem is that some of the information might be applicable to more than one plan, so I don't know how I would get around that.

    Thanks!

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Variation on an IF formula

    what "plan" names do you have??

  7. #7
    Registered User
    Join Date
    03-07-2013
    Location
    San Antonio
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Variation on an IF formula

    All I can say is the following without giving away confidential business information.

    Plan A
    Plan B
    Plan C
    Plan D
    Plan E
    Plan F
    Plan G
    Plan H
    Plan I

  8. #8
    Forum Contributor
    Join Date
    12-11-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    232

    Re: Variation on an IF formula

    I think there are a million ways to do things in excel, the trick is just seeing all the data. With what he provided I can't think of another way. Prob is your IF formula would be long with all your codes.

  9. #9
    Registered User
    Join Date
    03-07-2013
    Location
    San Antonio
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Variation on an IF formula

    Absolutely. I actually think this will work, so I really appreciate all of the help.

    Have a great weekend!

  10. #10
    DaveDeV
    Guest

    Re: Variation on an IF formula

    An interesting thread....

    Problem as stated was a specific instance lacking the rules for more general use and so - to an extent - was the solution put forward. I guess he'll be back...

    Given the concerns of proprietary info, let's try to come up with a common domestic analogy:

    For the OP's "Plan" let's use "Recipe"
    For the OP's Column A let's use "Ingredients" (some of which could recur in multiple recipes)
    The requirement is to sum only those Ingredients required in the selected Recipe.

    If this analogy is valid, then there is some data missing from the info provided - namely, lists of which Ingredients comprise each Recipe.

    The simplest way to structure this for data entry is probably via a 2-dimensional matrix where the Ingredients are listed across columns and the Recipes down rows. For each recipe, those ingredients required can be assigned a value of "Y" at the intersection cells.

    NB: This can be expanded by dropping the "Y" in favour of a quantity required - thereby incorporating some "configuration rules"

    For each "Recipe" construct a concatenated string of only those "Ingredient" codes with a "Y" (or a value >0, in which case, concatenate the quantity as well).

    The use of concatenation of only active items provides a contiguous list capability as opposed to just totals by unpacking the string in a separate summary table.

    I need to get to the bank before it closes so have to run, but when I get back, I'll knock together an example workbook and post it as an attachment.

    PS: I used this approach many years ago (in Multiplan) when in IT product marketing to build computer system configurator tools which was very similar but needed to include dependency-type rules.

    Until later...

    Dave

  11. #11
    DaveDeV
    Guest

    Re: Variation on an IF formula

    Back...

    Okay, I've knocked together a sample workbook that comprises the following worksheets:

    1) Tables and Lists for lookups and validation
    2) Configuration table to allow Plans to be "configured" with components and to construct configuration string per plan
    3) Evaluation sheet, which allows Plan to be selected, retrieves the string and unpacks it to build a cost table

    This approach of "build compacted string then unpack" eliminates blank lines in the final evaluation

    NOTE: This approach has been adopted to make understanding of the logic easier - NOT as a "plug 'n play module

    I hope this helps...

    Dave

    ATTACHMENT:

    ComponentsPerPlanEvaluation-DdV.xlsx

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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