+ Reply to Thread
Results 1 to 7 of 7

Define sum range based on column header

  1. #1
    Registered User
    Join Date
    01-06-2012
    Location
    Bristol
    MS-Off Ver
    Excel 2010
    Posts
    12

    Define sum range based on column header

    Hi there,

    I have a sheet (WorkingDays) that has working days for employees by month. Example attached.

    I have another sheet (Summary) where I have the current month value e.g. Mar

    On the summary sheet I want to display the cumulative working days for the year to date by person, based on the current month value. I need the sum range to be dynamic and expand as the month current month changes.

    Does anyone have any advice on how to achieve this?

    I tried to use INDIRECT and MATCH to get the col and row values for the sum, but the column value needs to be a letter and match returns a number.

    Any thoughts appreciated.

    Thanks,

    Tom
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    09-26-2014
    Location
    Moscow, Russia
    MS-Off Ver
    MSE 10, MSE 13
    Posts
    179

    Re: Define sum range based on column header

    Hello, Cleland.

    If I get it right... Take a look at the attachment.

    You may choose month from drop down list by clicking on month cell and then by clicking on small button that will appear to the right.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Best wishes and have a nice day!

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Define sum range based on column header

    Or this

    =SUMPRODUCT((WorkingDays!$A$2:$A$4=A4)*(MONTH(1&WorkingDays!$B$1:$M$1)<=MONTH(1&B$1))*(WorkingDays!$B$2:$M$4))
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  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,946

    Re: Define sum range based on column header

    If your names will always be in the same order, use this...
    =SUMIF(WorkingDays!$B$1:$M$1,Summary!$B$1,WorkingDays!B2:M2)

    If the names wont always be inthe same order, use this...
    =SUMPRODUCT((WorkingDays!$B$1:$M$1=Summary!$B$1)*(WorkingDays!$A$2:$A$4=Summary!A4)*WorkingDays!$B$2:$M$4)

    Both regular formulas, copied down.

    I like Rioran's idea of using a dropdown for the date, keeps it clean
    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
    Forum Contributor
    Join Date
    09-26-2014
    Location
    Moscow, Russia
    MS-Off Ver
    MSE 10, MSE 13
    Posts
    179

    Re: Define sum range based on column header

    Hello, Ford!

    Thank you, I appreciate your opinion =) And I also like your Idea of using SUMPRODUCT cheaty formula.

  6. #6
    Registered User
    Join Date
    01-06-2012
    Location
    Bristol
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Define sum range based on column header

    Very helpful. Thanks for the great ideas.

    Tom

  7. #7
    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,946

    Re: Define sum range based on column header

    Happy to help

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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] Define new range names based on existing range name offset 1 column to right
    By jprlimey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2014, 07:53 PM
  2. Range Select Based on Column Header
    By Nospmas in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2013, 11:27 AM
  3. Selecting a column range based on a value in header row
    By Ad83 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2012, 05:29 PM
  4. How do I set a dynamic range based on the column header?
    By gimiv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2007, 03:25 PM
  5. define range based on cell value in another column
    By samshut in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2007, 07:25 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