+ Reply to Thread
Results 1 to 5 of 5

Count amounts for years within multiple columns

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    Switzerland
    MS-Off Ver
    Excel 2007
    Posts
    3

    Count amounts for years within multiple columns

    Hi all,

    I'm trying to automate a report that calculates the amounts by years. To be honest, I'm expecting to do it in Power Bi by retrieving the information from a SharePoint list but let's see if I can have some help here, and then I'll try to translate it in DAX.
    I'm unfortunately not able to upload my data for any reason, but you can find the data below as an example.

    Year0 AmounY0 Year1 AmounY1 Year2 AmounY2 Year3 AmounY3
    2019 10 2020 10 2021 10 2022 10
    2020 20 2021 20 2022 20 2023 20
    2020 10 2021 10 2022 10 2023 10
    2019 10 2020 10 2021 10 2022 10
    2019 100 2020 100 2021 100 2022 100
    2021 20 2022 20 2023 20 2024 20
    2019 10 2020 10 2021 10 2022 10
    2020 100 2021 100 2022 100 2023 100
    2020 50 2021 50 2022 50 2023 50
    2019 20 2020 20 2021 20 2022 20
    2019 30 2020 30 2021 30 2022 30
    2022 10 2023 10 2024 10 2025 10

    As you can see, the column A contains the years and the columns C, E, G are only incrementing the year by +1.
    What I'd like to do is to have a formula that does the sum of the different amounts in the columns B, D, F, H based on the year that appears in the columns A, C, E, G.
    This should be dynamic, without having to enter the year we want. Any idea?

    Note that I reached to do it by entering the year with the formula:
    =SUMPRODUCT(($A$2:$A$13=K2)*($B$2:$B$13)+($C$2:$C$13=K2)*($D$2:$D$13)+($E$2:$E$13=K2)*($F$2:$F$13)+($G$2:$G$13=K2)*($H$2:$H$13))
    where "K2" contains the year.

    At the end, I'd like to have a graph showing the amounts over the years, as shown in the picture below, and that will for sure add the year 2025 if this year is added in the table.

    Many thanks in advance for your help

  2. #2
    Registered User
    Join Date
    10-05-2012
    Location
    Switzerland
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Count amounts for years within multiple columns

    I reached to attach an Excel file with dummy data
    Attached Files Attached Files

  3. #3
    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,063

    Re: Count amounts for years within multiple columns

    In L3, copied down:

    =SUMPRODUCT(($A$2:$G$13=K3)*$B$2:$H$13)
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    10-05-2012
    Location
    Switzerland
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Count amounts for years within multiple columns

    Thanks Glenn,
    Do you know if this is a way to avoid the reference to the "K3" cell, i.e. to automatically group by years?
    Thanks again for your help

  5. #5
    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,063

    Re: Count amounts for years within multiple columns

    I don't understand what you want!!

    =SUMPRODUCT(($A$2:$G$13=K3)*$B$2:$H$13)

    and

    =SUMPRODUCT(($A$2:$G$13=2019)*$B$2:$H$13)

    will produce the same result.

    =SUMPRODUCT(($A$2:$G$13=2019+rows($1:1)-1)*$B$2:$H$13)

    will increment the years as you copy down... but it seems rather silly to do that when all you get in a column of numbers and no idea which year they belong to. You need to explain more clearly (preferably on a new sample sheet) what you EXPECT to see. Forget about non-working formulae. Just show me what you want to see.

+ 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. Count amounts for years within multiple columns
    By moaaa in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 07-19-2019, 08:37 AM
  2. HR Data, Multiple Years by Month in columns
    By RandomSanity in forum Excel General
    Replies: 7
    Last Post: 06-27-2017, 11:17 AM
  3. Replies: 1
    Last Post: 05-27-2016, 06:54 PM
  4. Replies: 2
    Last Post: 05-27-2016, 03:59 AM
  5. [SOLVED] Calculating amounts in a single currency from a list of multiple currency amounts
    By Romsky in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-03-2013, 12:22 PM
  6. Countifs, from multiple columns, within range of years
    By xenomorph8472 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-14-2012, 01:15 PM
  7. Replies: 1
    Last Post: 12-05-2005, 08: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