+ Reply to Thread
Results 1 to 6 of 6

Excel grouping and sum

  1. #1
    Registered User
    Join Date
    07-13-2021
    Location
    Hong Kong
    MS-Off Ver
    365
    Posts
    8

    Excel grouping and sum

    Grouping.png

    I have data in column B and C, I want to use formula to make D and E.
    If I use =unique on D, the invoice numbers do not separate.
    If I use =sumif in E, I will get many duplicated value.
    Attached Files Attached Files
    Last edited by Bobbie Kan; 07-13-2021 at 11:26 PM.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Excel grouping and sum

    In D2 put this...
    =IF(COUNTIF($B$2:B2,B2)>1,"",B2)
    in E2 put this...
    =IF(SUMIF($B$2:$B$11,D2,$C$2:$C$11)=0,"",SUMIF($B$2:$B$11,D2,$C$2:$C$11))
    good luck

    EDIT: and you'll probably have to adjust the ranges, I only typed in as far as row 11 for the sumif, you'll have to adjust to your range.
    EDIT2: you might have to replace commas with semicolons for your location. So change the "," to ";" if your location needs it for formulas to work.
    Last edited by Sam Capricci; 07-13-2021 at 11:39 PM.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

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

    Re: Excel grouping and sum

    Here is an alternative solution using Power Query

    Excel 2016 (Windows) 32 bit
    G
    H
    1
    Invoice Number Sum of Invoices
    2
    HD 197367336
    9896
    3
    HD 195946475
    5390
    4
    HD 197367739
    7410
    5
    HD 197367415
    36435
    Sheet: Sheet1


    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    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
    07-13-2021
    Location
    Hong Kong
    MS-Off Ver
    365
    Posts
    8

    Re: Excel grouping and sum

    Quote Originally Posted by Sam Capricci View Post
    In D2 put this...
    =IF(COUNTIF($B$2:B2,B2)>1,"",B2)
    in E2 put this...
    =IF(SUMIF($B$2:$B$11,D2,$C$2:$C$11)=0,"",SUMIF($B$2:$B$11,D2,$C$2:$C$11))
    good luck

    EDIT: and you'll probably have to adjust the ranges, I only typed in as far as row 11 for the sumif, you'll have to adjust to your range.
    EDIT2: you might have to replace commas with semicolons for your location. So change the "," to ";" if your location needs it for formulas to work.
    It is working, thank you

  5. #5
    Registered User
    Join Date
    07-13-2021
    Location
    Hong Kong
    MS-Off Ver
    365
    Posts
    8

    Re: Excel grouping and sum

    Thank you, but I want the data to show exactly there.
    Sam's formula works good

  6. #6
    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
    80,242

    Re: Excel grouping and sum

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon 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 those who helped.
    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.

+ 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. Excel Grouping
    By Adamrom in forum Excel General
    Replies: 2
    Last Post: 01-13-2021, 09:49 AM
  2. Replies: 1
    Last Post: 11-06-2020, 05:45 PM
  3. Replies: 0
    Last Post: 12-10-2015, 08:24 AM
  4. Replies: 4
    Last Post: 07-26-2014, 02:35 AM
  5. Want to get a Series with Grouping and Sub-Grouping based on 2 criterias.
    By e4excel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-02-2011, 05:46 AM
  6. Excel Grouping
    By MJatAflac in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 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