+ Reply to Thread
Results 1 to 18 of 18

Sum IF that sums specific cells based on column choice

  1. #1
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Sum IF that sums specific cells based on column choice

    Hi.

    I have been trying to make excel sum values from different columns based on a choice made through a validation drop down menu. Basically let's say I choose E in the B1 drop down, I'd want the formula in B2 and C2 to sum each of their own values, so B2 would sum D2 and F2 while C2 would sum E2 and G2.

    I've provided an excel that hopefully clears up what I'm trying to do, been attempting to use various =SUMIFS but had no success.

    Hope this makes sense and thank you
    Attached Files Attached Files

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Sum IF that sums specific cells based on column choice

    is something like this what you are looking for? =IF(B1="D",SUM(D2:E2),IF(B1="E",SUM(F2:G2),if... etc.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    Kind off, but that formula would sum D2 and E2 for D and F2 and G2 for E. What I'm looking for is something like, let's say I choose D in the drop down column, then in the b2 field it would only show d2 value, and in the c2 field the e2 value would be shown.

    Then if I choose E in the drop down menu, in B2 it would sum the D2 value with the F2 value, skipping the E2 value in between. And C2 doing the same with E2 and G2, skipping the F2 in between.

  4. #4
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    Please ignore this double post
    Last edited by heneli627; 10-07-2015 at 05:16 AM.

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Sum IF that sums specific cells based on column choice

    In posts 1 and 3 you mention summing values depending on the dropdown selection.
    Then you mention that (also in post 3) that you "seem" to want a simple reference of if/then. Like this... =IF(B1="D",D2,IF(B1="E",F2)) etc.
    So I'm not clear. Perhaps you could give a few examples?

  6. #6
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    Mm, I think you got it for the first part, If you choose D in the drop down menu the cells would only be referenced, but then if you'd choose E, the previous cell D would be summed with the new one, so D2 and F2 would be summed, then if you chose F, D2 and f2 and h2 would be summed.

    So it would start with a reference but with the next option become a sum thing, does that make sense?

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Sum IF that sums specific cells based on column choice

    Still not clear. I will be offline for a while so I'll check back later to see if someone has helped you.

  8. #8
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    Provided an image, hope it helps

    Skärmavbild 2015-10-07 kl. 11.51.17.png

  9. #9
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Sum IF that sums specific cells based on column choice

    It looks to me like you have two entries for each identifier. In column B, you want to sum up the 1st entries up to the indicated identifier, and in column C you want to sum up the 2nd entries, does that sound correct?

    I think I would add a helper row so that I can help Excel see the 1st and 2nd entries. Then my conditional sum can be a simple sumif() or sumifs(). Maybe add a row of 1,2,1,2,... in the 4th row. Then my sumifs() can be something like =sumifs(row5,row3,"<"&choice,row4,"=1").
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  10. #10
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    So if we were to use the picture above as an example, I'd put 1,2,1,2 under the letters to help excel differentiate? But I'm not sure how to use =sumifs to help recognize what letter I choose in the drop down menu.

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Sum IF that sums specific cells based on column choice

    When I first encounter an unfamiliar Excel function, I start by reviewing the help file for that function: https://support.office.com/en-us/art...6-611cebce642b (there should be a similar help file in your Excel installation). This page will explain the syntax for using the function, descriptions of the required arguments for each function, and examples of how to use the function.
    If I need additional examples, usually a quick internet search for "excel sumifs function" will reveal multiple pages with different examples of how to use the desired function.

    So, in the example we are creating, your sum_range would be row 5. Rows 3 and 4 would be the two criteria ranges. The criteria associated with row 4 will be either 1 or 2 depending on which one you want summed. The criteria associated with row 3 would be a text string "<"&B3 (& is the concatenate operator that takes two text strings and concatenates them together).

    Does that help you understand how to use SUMIFS()?

  12. #12
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    Thank you for the explanation, I'd like to say I understand it but... I'm not getting it to work . There's something wrong the criteria range I've put, but I can't figure out what.

    The sumifs I used is
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Sum IF that sums specific cells based on column choice

    I think it is the difference between "<" and "<=". The former does not find the cases that =D, only those that precede D (A,B,C). See if using "<=" (which should include the "D" columns) corrects the problem.

  14. #14
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    That seems do have done the trick thank you for everything.

  15. #15
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    Back to having issues, I've changed the D letters to month names, which I believe the code does not recognize properly. Have provided the workbook I'm using.
    Attached Files Attached Files

  16. #16
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Sum IF that sums specific cells based on column choice

    Try this, I reformatted your date cells to make the "<=" work. Less than or equal to won't work with text. So I changed each of your months to dates - generalized to 1/1/2015 for January and 2/1/2015 for February etc.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    02-20-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Sum IF that sums specific cells based on column choice

    That did it, thank you!

  18. #18
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Sum IF that sums specific cells based on column choice

    Great, don't forget to mark the post as solved using the thread tools dropdown at the top of the post. And thank you for the reputation.

+ 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. [SOLVED] Calculating sums to a spesific cell depending on choice from dropdown.
    By Artsipappa in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-06-2015, 02:24 AM
  2. Replies: 13
    Last Post: 04-30-2015, 05:58 PM
  3. Replies: 5
    Last Post: 01-29-2014, 01:35 PM
  4. Fill cells in one column based on specific words or letter from another column
    By dokkadokka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-21-2013, 07:04 AM
  5. IF Functions: Combining different calculations based on choice from one column
    By Nairobi Nice in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-19-2013, 07:31 AM
  6. Replies: 2
    Last Post: 07-10-2012, 04:37 PM
  7. How to sum a column based on the choice of autofilter?
    By Mr.G in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2005, 01:06 PM

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