+ Reply to Thread
Results 1 to 10 of 10

Excel-13 Add values in array matching specific row labels, column labels within date range

  1. #1
    Registered User
    Join Date
    06-13-2014
    Posts
    5

    Question Excel-13 Add values in array matching specific row labels, column labels within date range

    Hi everyone,

    I'm having trouble finding a function that will work for what I need. I attached an example of what I'm working with. Basically I need a function that will add values in the array C2:J6 where the row label in column A equals "Client2",the row label in column B equals "REV", and the column header falls between two dates (6/1/14 and 9/30/14 inclusive for this example). The output I'm looking for in this example is 2,216.00.

    Any suggestions?? Thanks in advance, I appreciate any help!

    example.xlsx

    Dan

  2. #2
    Valued Forum Contributor
    Join Date
    09-25-2011
    Location
    Eastbourne, England
    MS-Off Ver
    Excel 2010
    Posts
    1,089

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    Hi fadeoutagain27

    Welcome to the forum.

    You say that you want to add values, so just to be clear, when your conditions are met, do you want the cell value to be 2216 or 520+2216 ?

    Will the answer always be this 2,216.00 (which, I suppose, is a nice enough figure) or do you nee the facility to change this figure?

    You mention "function"; are you expecting a user defined function, or will a bit of VBA be OK ?

    Regards
    Alastair

  3. #3
    Registered User
    Join Date
    06-13-2014
    Posts
    5

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    Hi Alastair - thanks for the reply! Sorry for the delay in getting back to you.

    I need the cell value in this example to be 2216, which is the sum of cells C4:F5. The answer will not always be 2216 - it will change depending on the dates in the header (row 1). In my actual file, the data in cells C2:J6 changes (via lookups and sumifs) depending on the date in the header. I've attached another example file to try to help illustrate what I'm looking for (see below). Does that help? I don't think VBA should be necessary here, but if you feel otherwise I'm definitely open to it!

    Thanks again!

    Dan

    example 2.xlsx
    Last edited by fadeoutagain27; 06-17-2014 at 04:52 PM.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    I notice the date headers are all end of month dates.

    As the date criteria you have:

    Start date: 6/1/2014
    End date: 9/30/2014

    Will the end date always be an end of month date?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    06-13-2014
    Posts
    5

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    Yes, the dates in the header will always be the last day of the month and the end date of the criteria range will always be too. Also, the headers will always be chronological and each month will only occur once.

  6. #6
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,372

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    Perhaps something like this? That's array formula, you need to press CTRL-SHIFT-ENTER button together, just ENTER alone is not working....

    Cheers
    Attached Files Attached Files

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    Quote Originally Posted by fadeoutagain27 View Post
    Yes, the dates in the header will always be the last day of the month and the end date of the criteria range will always be too. Also, the headers will always be chronological and each month will only occur once.
    Using cells to hold the criteria:

    A25 = Client2
    B25 = Rev
    C25 = start date = 61/2014
    D25 = end date = 9/30/2014

    =SUMPRODUCT((A5:A9=A25)*(B5:B9=B25)*(C4:J4-DAY(C4:J4)+1>=C25)*(C4:J4<=D25)*C5:J9)

  8. #8
    Registered User
    Join Date
    06-13-2014
    Posts
    5

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    Thanks guys, I'll give those both a shot when I get into work. Much appreciated.

  9. #9
    Registered User
    Join Date
    06-13-2014
    Posts
    5

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    Both of these solutions worked for me!! Thanks again, Tony and Azumi, I really appreciate the assistance!

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel-13 Add values in array matching specific row labels, column labels within date r

    You're welcome. We appreciate the feedback!

+ 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. Pivottable: move "∑ values" label between row labels and column labels through VBA
    By Need_help_please in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-14-2018, 05:01 AM
  2. Pivot Table - Show Row labels horizontally (Not as Column labels)
    By Catsup in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-16-2014, 01:15 PM
  3. Replies: 3
    Last Post: 10-24-2013, 10:34 AM
  4. Replies: 0
    Last Post: 07-03-2012, 11:09 AM
  5. [SOLVED] Copying Values to matching labels
    By Craig in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2005, 08:05 PM

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