+ Reply to Thread
Results 1 to 19 of 19

Sum each row with based on Col A of Data Sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Sum each row with based on Col A of Data Sheet

    Hi,

    How can I get the result in as mentioned in 'Result' Sheet ? .My raw data is in 'Data' sheet.Lookup column is A.
    Attached Files Attached Files

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

    Re: Sum each row with based on Col A of Data Sheet

    If you have the latest (beta) version of 365:

    =VSTACK(A1:G1,HSTACK(UNIQUE(A2:B10),DROP(DROP(GROUPBY(A2:A10&B2:B10,C2:G10,SUM),,1),-1)))
    Attached Files Attached Files
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Sum each row with based on Col A of Data Sheet

    Quote Originally Posted by AliGW View Post
    If you have the latest (beta) version of 365:

    =VSTACK(A1:G1,HSTACK(UNIQUE(A2:B10),DROP(DROP(GROUPBY(A2:A10&B2:B10,C2:G10,SUM),,1),-1)))
    Oops no latest beta version.Sadly it didn't worked in my version of 365.

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

    Re: Sum each row with based on Col A of Data Sheet

    C2=IFERROR(IF(Result!$A2<>"",SUMIFS(INDEX(Data!$C$2:$G$100,,MATCH(Result!C$1,Data!$C$1:$G$1,0)),Data!$A$2:$A$100,Result!$A2,Data!$B$2:$B$100,Result!$B2),""),"")

    Copy across and down

  5. #5
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Sum each row with based on Col A of Data Sheet

    Quote Originally Posted by CARACALLA View Post
    C2=IFERROR(IF(Result!$A2<>"",SUMIFS(INDEX(Data!$C$2:$G$100,,MATCH(Result!C$1,Data!$C$1:$G$1,0)),Data!$A$2:$A$100,Result!$A2,Data!$B$2:$B$100,Result!$B2),""),"")

    Copy across and down
    No,I want in the entire result in the same format perhaps spill rather than copy across & below.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,432

    Re: Sum each row with based on Col A of Data Sheet

    All you have to do is change your update channel to the beta channel: Account > change to Miscrosoft 365 Insider, then run an update.

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

    Re: Sum each row with based on Col A of Data Sheet

    If you don't have the beta version, or need to share it with other O365 users who do not have the beta version, then use:

    Formula: copy to clipboard
    =LET(
    A,Data!A2:B10,
    B,Data!C2:G10,
    C,UNIQUE(INDEX(A,SEQUENCE(ROWS(A)),{1,2})),
    VSTACK(A1:G1,HSTACK(C,DROP(REDUCE("",INDEX(C,,1),LAMBDA(x,y,VSTACK(x,BYCOL(B,LAMBDA(z,SUMIF(INDEX(A,,1),y,z)))))),1))))
    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

  8. #8
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Sum each row with based on Col A of Data Sheet

    Mindblowing Glenn.You did it.

    Thanks.
    Last edited by paradise2sr; 01-15-2024 at 04:36 AM.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,432

    Re: Sum each row with based on Col A of Data Sheet

    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 each of those who offered help.

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,976

    Re: Sum each row with based on Col A of Data Sheet

    Glenn,
    Why UNIQUE(INDEX(A,SEQUENCE(ROWS(A)),{1,2})) rather than just UNIQUE(A) out of interest?
    Everyone who confuses correlation and causation ends up dead.

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

    Re: Sum each row with based on Col A of Data Sheet

    Quote Originally Posted by rorya View Post
    Glenn,
    Why UNIQUE(INDEX(A,SEQUENCE(ROWS(A)),{1,2})) rather than just UNIQUE(A) out of interest?
    No coffee yet.

    Actually A originally referred to columns A:G. I changed its definition, but didn't change the unique bit correspondingly. Again, caused by no coffee.
    Last edited by Glenn Kennedy; 01-15-2024 at 05:00 AM.

  12. #12
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,976

    Re: Sum each row with based on Col A of Data Sheet

    Quote Originally Posted by Glenn Kennedy View Post
    No coffee yet.

    Actually A originally referred to columns A:G.
    I figured it would be something like that (on both counts), but wanted to check I wasn't missing something. Thanks.

  13. #13
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Sum each row with based on Col A of Data Sheet

    I little bit changes done in Glenn formula referencing header to the data sheet and works like a charm.

    =LET(
    A,Data!A2:B10,
    B,Data!C2:G10,
    C,UNIQUE(INDEX(A,SEQUENCE(ROWS(A)),{1,2})),
    VSTACK(Data!A1:G1,HSTACK(C,DROP(REDUCE("",INDEX(C,,1),LAMBDA(x,y,VSTACK(x,BYCOL(B,LAMBDA(z,SUMIF(INDEX(A,,1),y,z)))))),1))))

  14. #14
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Sum each row with based on Col A of Data Sheet

    Thanx Ali & Caracalla

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

    Re: Sum each row with based on Col A of Data Sheet

    Now replete with coffee...

    use this:

    =LET(
    A,Data!A2:B10,
    B,Data!C2:G10,
    C,UNIQUE(A),
    VSTACK(A1:G1,HSTACK(C,DROP(REDUCE("",INDEX(C,,1),LAMBDA(x,y,VSTACK(x,BYCOL(B,LAMBDA(z,SUMIF(INDEX(A,,1),y,z)))))),1))))

  16. #16
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Sum each row with based on Col A of Data Sheet

    Hi,Glenn, I came across one more things.My A column data must be unique,Sometimes what happen B column name might be different but A column code is always the unique.So currently I am have used your formula at A1 Sheet in which it is displaying Rose twice as one of the B column data is 'Roses' so I want to skip based on unique data already achieved at A3.So there seems to be duplicate in such type of cases where one or more B Column name might be different but A column data is unique irrespective of name in B column.This happens frequently.I have given a sample example of Rose & Roses only. I hope you understand this.

    Hence,kindly modify your code accordingly and I have mentioned the actual result at I2:O6 of Result worksheet.
    Attached Files Attached Files
    Last edited by paradise2sr; 01-15-2024 at 09:00 AM.

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

    Re: Sum each row with based on Col A of Data Sheet

    tRY:

    Formula: copy to clipboard
    =LET(A,Data!A2:G10,B,Data!A1:G1,C,UNIQUE(INDEX(A,,1)),D,XLOOKUP(C,INDEX(A,,1),INDEX(A,,2)),E,DROP(REDUCE("",C,LAMBDA(x,y,VSTACK(x,BYCOL(DROP(A,,2),LAMBDA(z,SUMIF(INDEX(A,,1),y,z)))))),1),VSTACK(B,HSTACK(C,D,E)))
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Sum each row with based on Col A of Data Sheet

    Thanx Glenn.

  19. #19
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,408

    Re: Sum each row with based on Col A of Data Sheet

    Power Query
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"test", "Name/Date"}, "Attribute", "Value"),
        #"Grouped Rows" = Table.Group(#"Unpivoted Other Columns", {"test", "Name/Date", "Attribute"}, {{"sum", each List.Sum([Value]), type number}}),
        #"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[Attribute]), "Attribute", "sum")
    in
        #"Pivoted Column"
    Attached Files Attached Files

+ 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] Copy data from Sheet b to Sheet A, based on the existing contents of Sheet A
    By patrickrw99 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-01-2022, 04:51 AM
  2. Replies: 1
    Last Post: 03-01-2022, 03:25 AM
  3. Replies: 2
    Last Post: 01-23-2016, 01:16 PM
  4. Replies: 4
    Last Post: 10-16-2015, 12:59 PM
  5. Need a code to generate data on sheet 1 based on data from sheet 2, multiple critereia
    By TrinhTran02 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-12-2015, 03:10 PM
  6. [SOLVED] Copy and paste data from sheet 2 to sheet 1 based on specific criteria on sheet 1
    By VBADUD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 04:18 AM
  7. As user fills out data sheet, then fill out a results sheet based on data sheet entry
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-13-2012, 03:57 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