+ Reply to Thread
Results 1 to 18 of 18

Summarise a matrix

  1. #1
    Registered User
    Join Date
    01-13-2016
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    6

    Summarise a matrix

    Hello,

    I would like to know if someone could help me with the following;

    I have a database in a matrix, where rows and columns have a country name, then the character "_", then a sector code. I would like to create a summary table, as seen on the screenshot below, which would sum every corresponding row/column. I tried with SUMIFS and DSUM but I have troubles adapting to my case.

    Many thanks in advance,

    EDIT: had to resubmit as I have cases where the RIGHT function doesn't work, as sectors don't always have three characters.
    Attached Files Attached Files
    Last edited by Pixandco; 05-07-2023 at 10:53 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,086

    Re: Summarise a matrix

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,900

    Re: Summarise a matrix

    Hi and welcome to the forum

    Pictures are of little value. Honestly, no one wants to re-type your data to try and solve your issue. Additionally, we would only be guessing at how your data was structured, ie. formulas, formatting, etc. Additionally, due to how some browsers behave, many of our members cannot see uploaded pictures/images. Please do not take this route.

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and an "After" of what you wish the output to be.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    01-13-2016
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Summarise a matrix

    Thanks for both replies and sorry for the lack of attachment :-) Just uploaded the example.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,086

    Re: Summarise a matrix

    And you are using Office 2016?

  6. #6
    Registered User
    Join Date
    01-13-2016
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Summarise a matrix

    That was when I first joined your forum, I just updated my profile :-) Thanks,

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,096

    Re: Summarise a matrix

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,086

    Re: Summarise a matrix

    In B13 copied across and down:

    =SUMPRODUCT((RIGHT($A$2:$A$10,3)=$A13)*(RIGHT($B$1:$G$1,3)=B$12)*($B$2:$G$10))
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    01-13-2016
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Summarise a matrix

    Amazing, thank you Fluff and AliGW. Super quick and great turnaround.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,086

    Re: Summarise a matrix

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) 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 all those who offered help.

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

    Re: Summarise a matrix

    B13=IF(AND($A13<>"",B$12<>""),SUMPRODUCT((RIGHT($A$2:$A$10,3)=$A13)*(RIGHT($B$1:$G$1,3)=B$12)*($B$2:$G$10)),"")

    Copy across and down

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,096

    Re: Summarise a matrix

    Glad to help & thanks for the feedback.

  13. #13
    Registered User
    Join Date
    01-13-2016
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Summarise a matrix

    I am sorry, I had to resubmit as I have cases where the RIGHT function doesn't work, as sectors don't always have three characters. I tried to adapt the function you gave me with the TRIM function, to keep only what is after the first "_" character, but to no avail.

    I reuploaded a sheet.

    Many thanks in advance,

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,086

    Re: Summarise a matrix

    Try this:

    =SUMPRODUCT((MID($A$2:$A$10,FIND("_",$A$2:$A$10)+1,99)=$A13)*((MID($B$1:$G$1,FIND("_",$B$1:$G$1)+1,99)=B$12)*($B$2:$G$10)))
    Attached Files Attached Files

  15. #15
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,096

    Re: Summarise a matrix

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    EDIT:
    If you could have Values like CA01 this will fail
    Last edited by Fluff13; 05-07-2023 at 11:13 AM.

  16. #16
    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,087

    Re: Summarise a matrix

    Try:

    =SUMPRODUCT((TEXTAFTER($A$2:$A$10,"_",1)=$A13)*(TEXTAFTER($B$1:$G$1,"_",1)=B$12)*$B$2:$G$10)
    Attached Files Attached Files
    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

  17. #17
    Registered User
    Join Date
    01-13-2016
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Summarise a matrix

    Thanks a lot for all the answers, helped me a lot! Amazing support :-)

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

    Re: Summarise a matrix

    B13=IF(AND($A13<>"",B$12<>""),SUMPRODUCT((ISNUMBER(SEARCH($A13,$A$2:$A$10)))*(ISNUMBER(SEARCH(B$12,$B$1:$G$1)))*($B$2:$G$10)),"")

    Copy across and down

+ 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] Convert qty of matrix items to matrix groups
    By OAKLEY in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-12-2019, 06:31 PM
  2. [SOLVED] 9 Cells Matrix / GE Matrix chart hellp
    By vani2004 in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 11-20-2018, 02:34 PM
  3. Matrix Multiplication in VBA and storing values in another matrix
    By anwid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2018, 06:23 AM
  4. Replies: 2
    Last Post: 11-05-2014, 03:41 AM
  5. Eigenvector of matrix for nxn matrix of variable size
    By rocketscientist165 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2014, 10:51 AM
  6. Replies: 2
    Last Post: 02-11-2014, 05:05 AM
  7. Using a transition matrix as input to a cummulative matrix
    By Walter12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2012, 04:19 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