Using GROUPBY to Create a Summary Table

Written by Allen Wyatt (last updated March 6, 2026)
This tip applies to Excel Excel in Microsoft 365


Tressa has a worksheet that includes raw customer sales transaction data for the western division of her company. Column E contains the state in which each customer lives, and column G contains the order amount for each transaction. She's been told that she can use the new GROUPBY function to create a simple summary table that shows sales by state, but she's unclear on exactly how to do this.

The traditional way to create a summary table is to create a PivotTable, but some of the newest functions in Excel have provided simple ways to get the summary without doing so. One of those functions is GROUPBY, which is currently only available in Microsoft 365. In Tressa's situation, the function would be quite easy:

=GROUPBY(E:.E,G:.G,SUM)

There are three parameters in this instance, all of which are required. The first is the values to be used for grouping. Since Tressa wants a summary by state, that is why column E is specified as a range for this parameter. The second parameter is the range of values to be aggregated. The first range and this second range should both have the same number of elements. Finally, the third parameter is the function to be used in doing the aggregating. In this case, the SUM function is specified because Tressa wants to add all the amounts together, by state.

The result of this is a two-column summary based on the states in column E, summing the values in column G. At the bottom of the summary is a grand total of all the states. The appearance of the summary table can be modified a bit by using some of GROUPBY's optional parameters. Personally, I like to add two parameters, as shown here:

=GROUPBY(E:.E,G:.G,SUM,3,0)

The fourth parameter (3) indicates if the source data has headers or not, as well as what to do with them. This can be a value of 0 (no headers), 1 (yes, no show), 2 (no, generate), or 3 (yes, show).

The fifth parameter (0) indicates if subtotals or totals should be included in the summary. Possible values are 0 (no totals), 1 (grand totals), 2 (grand and subtotals), -1 (grand totals at top), and -2 (grand and subtotals at top). If you leave this parameter off, then GROUPBY provides grand and subtotals according to its best guess.

If you want more info on the GROUPBY function, here are two good places to find it:

https://support.microsoft.com/en-us/office/5e08ae8c-6800-4b72-b623-c41773611505
https://exceljet.net/functions/groupby-function

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13965) applies to Microsoft Excel Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Quickly Accessing Spelling and Grammar Options

You can change the way Word handles spelling and grammar checks through the menus. But there is a quicker way to access ...

Discover More

Removing Specific Fields

Word allows you to place all sorts of fields in your documents. If you want to search for only specific types of fields, ...

Discover More

Stopping the Deletion of Cells

You can delete cells from a worksheet, and Excel will move the remaining cells either to the left or upwards. Deletions, ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2019 For Dummies today!

More ExcelTips (ribbon)

Median of Selected Numbers

Need to find a median value in a series of values? It's easy with the MEDIAN function. What isn't as easy is to derive ...

Discover More

Random Numbers in a Range

Excel provides several different functions that you can use to generate random numbers. One of the most useful is the ...

Discover More

Limiting the Number of Results from a Function

Some of the newer functions in Excel can return quite a bit of information. If you want to limit what is returned, then ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is seven more than 4?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.