+ Reply to Thread
Results 1 to 6 of 6

sum columns by condition

  1. #1
    Registered User
    Join Date
    08-30-2009
    Location
    melbourne
    MS-Off Ver
    Excel 2016 / 2019
    Posts
    84

    sum columns by condition

    Hi,

    Example file is attached.

    The 1st row indicates year&month.

    In 2nd row, column A indicates effective year&month; and the rest columns are quantity per each month.

    I would like to sum the quantity based on column A value.

    say, the effective year and month is 202311 and I would like to sum of next 12 months only in Column W - that is, between 202311 and 202410.

    How can I achieve this?

    I tried with sumifs function but could not make it happen.
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: sum columns by condition

    tRY:

    =SUM(INDEX(2:2,,MATCH(A2,1:1,0)):INDEX(2:2,,MATCH(A2,1:1,0)+11))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,784

    Re: sum columns by condition

    X2=sumproduct((text(b1:v1&"01"+0,"0000-00-0")+0>=(text(a2&"01"+0,"0000-00-0")+0))*(text(b1:v1&"01"+0,"0000-00-0")+0<=edate(text(a2&"01"+0,"0000-00-0")+0,11))*(b2:v2))
    Last edited by CARACALLA; 12-01-2023 at 10:08 AM.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: sum columns by condition

    Another solution:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-30-2009
    Location
    melbourne
    MS-Off Ver
    Excel 2016 / 2019
    Posts
    84

    Re: sum columns by condition

    Thank you all, perfect

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: sum columns by condition

    You're welcome. Thanks for letting us know that you got an answer.




    Please take a moment and consider clicking the "Add Reputation" button at the foot of any of the posts of anyone who helped you reach a solution here today.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

+ 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. split two columns to multiple columns based on condition
    By Alaa-A in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-15-2021, 11:20 PM
  2. SUM Columns with Data IF Condition is met
    By emma.foster in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-17-2020, 09:33 PM
  3. sum of columns with a condition
    By Yoni17 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-01-2020, 12:17 PM
  4. [SOLVED] Condition Forumula if Columns have Strings and if they match to preset condition
    By rosn.dhakal in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-02-2018, 10:57 PM
  5. condition on two columns
    By maroon1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-27-2016, 01:14 AM
  6. Add Zero Value Row if Condition from Two Columns met
    By mattyj2009 in forum Excel General
    Replies: 3
    Last Post: 05-20-2016, 10:25 AM
  7. [SOLVED] Splitting Value into different columns with condition :)
    By supremexx in forum Excel General
    Replies: 6
    Last Post: 05-03-2015, 11:26 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