+ Reply to Thread
Results 1 to 5 of 5

Formula to sum all cells in 1 column above a certain cell with criteria.

  1. #1
    Registered User
    Join Date
    05-26-2021
    Location
    California
    MS-Off Ver
    MS 365
    Posts
    8

    Question Formula to sum all cells in 1 column above a certain cell with criteria.

    Hello,

    I'm looking for a way to sum a range of cells where the range is dependent on what I choose from a dropdown menu. So I have a dropdown menu of 52 options (one for each week of the year) and if i choose for example, Week 12, the formula would sum everything from week 1 to week 12. Then have another formula that if I select week 12, it would sum everything up to week 11.

    In attached excel, on the "Weekly Worksheet" tab, in F2 i have a dropdown. if i select one of the options, i would like if in B2 it would sum the range up to that week, and in C2 it would sum the range before that. For example if I choose MW12, then B2 sums the range in the "Daily KPIs New" tab, column D, from D2:D85. Then C2 would sum the range D2:D78.

    I am already using this formula to sum the total for each week, =SUMIF('Daily KPIs New'!A:A,'Weekly WorkSheet New'!F2,'Daily KPIs New'!D:D) , but this gives me the weekly sum, so now I need the full year up to that week basically.

    Hope this makes sense.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    11-07-2011
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Formula to sum all cells in 1 column above a certain cell with criteria.

    Hi ScardiB,

    Not sure if this is the most elegant solution but I've tested it and it works.

    For your 'YTD Actual' in cell B2, use the following:
    =SUM(INDIRECT("'Daily KPIs New'!D2"&":D"&MATCH(F2,'Daily KPIs New'!$A$1:$A$365,0)+6))

    For your 'YTD Goal' in cell C2, use the following:
    =SUM(INDIRECT("'Daily KPIs New'!D2"&":D"&MATCH(F2,'Daily KPIs New'!$A$1:$A$365,0)-1))

    The Match formula looks for the corresponding row number matching your week selection, going either to the end of the week (+6) or to the end of the previous week (-1).
    The Indirect formula then turns that number into a cell reference that can be used by Sum.

    Regards,

    Daniel.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Formula to sum all cells in 1 column above a certain cell with criteria.

    Sum YTD:

    Please Login or Register  to view this content.
    Assum column D's date is only from 1-Jan
    If date expand multi year, you may need one more criteria:
    Please Login or Register  to view this content.
    Quang PT

  4. #4
    Registered User
    Join Date
    05-26-2021
    Location
    California
    MS-Off Ver
    MS 365
    Posts
    8

    Re: Formula to sum all cells in 1 column above a certain cell with criteria.

    This worked! Thank you, I was able to use the formulas to pull from other range areas on other tabs as well and it translated through.

    thank you

  5. #5
    Registered User
    Join Date
    05-26-2021
    Location
    California
    MS-Off Ver
    MS 365
    Posts
    8

    Re: Formula to sum all cells in 1 column above a certain cell with criteria.

    This worked as well! When I tried to use the same structure of the formula on another data range and sheet, it didn't pull the right numbers for some reason, even though I set it up just like this with the correct columns and references.

    But either way, it worked for my initial question. Thank you!

+ 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. Replies: 7
    Last Post: 07-15-2020, 10:52 AM
  2. [SOLVED] Sum up different cells into one cell based on another Column criteria
    By fabian_76 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-29-2018, 11:45 AM
  3. [SOLVED] Formula to use to count the number of cells in a column which meet three sets of criteria
    By Dhabitude in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 12-11-2013, 11:22 AM
  4. [SOLVED] Loop to find cells based on criteria, enter formula into next empty column
    By cschoyer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-10-2012, 03:32 PM
  5. [SOLVED] Create a formula to add cells in one column if it meets the criteria for another column
    By Tamarissa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2012, 11:27 AM
  6. Replies: 0
    Last Post: 07-22-2012, 01:05 PM
  7. [SOLVED] Need formula that will sum cells in a column bases on criteria in other cells.
    By Jim in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-18-2006, 11:35 AM

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