+ Reply to Thread
Results 1 to 9 of 9

Sum by Row Criteria and Column Header

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    167

    Sum by Row Criteria and Column Header

    Hello,

    I am looking for VBA Array or Scripting Dictionary Method to solve the problem, currently i am using the "SUMPRODUCT" formula to get the sum values based on row and column criteria.

    Data is the main sheet , using Sum product i am getting the values to output, this sample file only in original file having more rows and columns.

    Need code to get until last row and last column

    Any help appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Sum by Row Criteria and Column Header

    there is simple and power way
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    in the case of date is arranged then
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Sum by Row Criteria and Column Header

    Please try


    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    08-19-2009
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    167

    Re: Sum by Row Criteria and Column Header

    Hello Bo_Ry,

    I tested the code, its just consolidating from Sheet "DATA" to "OUTPUT" sheet, sometimes the data in sheet "DATA" will be different,

    to "OUTPUT" sheet.

    Example - In "DATA" sheet there is no Jun-20 month then the "Jun-20" in "OUPUT" sheet should be blank.

    I need only the number values in month column based on the highlighted criteria and no other details should be changed.
    Attached Files Attached Files

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Sum by Row Criteria and Column Header

    Try formula

    =IFERROR(SUMIFS(INDEX(Data!$P$2:$BB$27,,MATCH(M$1,Data!$P$1:$BB$1,)),ID,$A2,Name,$B2,Dept,$E2,Level,$K2),0)

    or VBA

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    08-19-2009
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    167

    Re: Sum by Row Criteria and Column Header

    Hello Bo_Ry

    The column range should be dynamic, currently its fixed to BB1

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Sum by Row Criteria and Column Header

    Code is here. It calculates till the column filled in row1. Last row last filled row in Column A.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  8. #8
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Sum by Row Criteria and Column Header

    Last try

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    08-19-2009
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    167

    Re: Sum by Row Criteria and Column Header

    Thanks Bo_Ry, it worked

+ 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] SUMIF with column & row header criteria
    By maxi0009in in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-20-2021, 10:40 AM
  2. [SOLVED] Unique List From Row Name Based On Criteria from Column Data Header and Column Contents
    By jweatherford in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-05-2020, 10:19 AM
  3. Replies: 4
    Last Post: 09-04-2020, 03:10 AM
  4. [SOLVED] VBA Code to return Column header based on Criteria
    By nr6281 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-14-2019, 03:37 AM
  5. Replies: 0
    Last Post: 06-04-2015, 07:57 AM
  6. [SOLVED] average whole column if header matches criteria
    By doylzer in forum Excel General
    Replies: 6
    Last Post: 09-22-2014, 08:20 AM
  7. Return column header based on column criteria and number value
    By bwill22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2014, 07:33 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