How to Sum/Extract Data by Month in Columns/Tables in Excel

In our daily work, sometimes we may get original data in a table provided by customer or partner without arrangement, and if we want to arrange data by month or other criteria like group or others, we need to sum/extract data based on data range and then sum data and list them into another table. In this case, we need to learn how to sum data by month in columns refer to original data. Actually, we can use formula contains SUMIFS function and EOMONTH function to sum values. This tutorial will show you the way with simple descriptions and screenshots, and let you know how to use above two functions clearly.

EXAMPLE:


See screenshot above, we list original data in the left table, and we want to summarize them into the right table. Though we can pick data from left table and copy/past them into right table, this is troublesome and time consuming. Actually, we can apply a formula to calculate data correctly.

FORMULA:


In F4 enter the formula:

=SUMIFS($C$4:$C$15,$A$4:$A$15,$E4,$B$4:$B$15,”>=”&F$3,$B$4:$B$15,”<=”&EOMONTH(F$3,0))

HOW THIS FOMULA WORKS:

This formula is based on SUMIFS function, also use EOMONTH function inside of SUMIFS.

For EOMONTH function, the syntax is =EOMONTH(start_date, months), it returns the last date of a month for a specific date. For example, if date is 01/01/2020, then EOMONTH(date,0) returns 01/31/2020. In this instance, as we want to sum data belongs to October, so we need to statistic the amount for a product in a whole month. Actually, in F3, the real date is 10/1/2020, we just convert it to ‘mmm’ in customer data format.

For SUMIFS function, it sum data with multiple criteria, the syntax is =SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …).

In this case, ‘sum range’ is data in ‘Amount’ list, the actual range is $C$4:$C$15, due to it is an absolute range, we don’t want to change the range when applying the formula for other cells, so we add $ before row and column number.

‘$A$4:$A$15’ is the first criteria range, and $E4 value ‘C4003’ is the first criteria, the first criteria combination ‘$A$4:$A$15,$E4’ means we want to find out product ‘C4003’ among the absolute range ‘$A$4:$A$15’. We add $ before E to lock E column, so even row is changed when coping the formula for other product in E column, the column is locked at that time.

‘$B$4:$B$15,”>=”&F$3’,’$B$4:$B$15,”<=”&EOMONTH(F$3,0)’ are criteria 2 and criteria 3. As we mentioned above, for F$3, it is 10/1/2020 in fact, so EOMONTH(F$3,0) is 10/31/2020, then we just need to find out proper date among date list ‘$B$4:$B$15’ which is greater than or equals to F$3 (10/1/2020), and less than or equals to EOMONTH(F$3,0) (10/31/2020). We add $ before row number, that’s because Oct, Nov and Dec are all listed in row 3, so we just keep row number locked in the formula.

RESULT:


Let’s see if this formula works correctly.

It works well. So we can drag this cell to copy the formula to other cells.

NOTES:

1.If you are consumed about the range in the formula, you can name range firstly, for example

$C$4:$C$15=Amount;

$A$4:$A$15=Product;

$B$4:$B$15=Date;

Then update formula to =SUMIFS(Amount,Product,$E4,Date,”>=”&F$3,Date,”<=”&EOMONTH(F$3,0)). It looks clearly now.

2. Oct, Nov, Dec should be actually date 10/01/2020, 11/01/2020, 12/01/2020 properly, then use Format Cells feature to convert them to proper format ‘mmm’ by Custom. Otherwise it may occur error when applying the formula due to format is improper.

Related Functions


  • Excel SUMIFS Function
    The Excel SUMIFS function sum the numbers in the range of cells that meet a single or multiple criteria that you specify. The syntax of the SUMIFS function is as below:=SUMIFS (sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)…
Related Posts

How to Sum if Equal to Many Items or A Range in Excel
How to Sum if Equal to Many Items 12

If we want to sum numbers from a range with criteria, we often select SUMIF of SUMIFS functions as the first choice to create a formula. The criteria can be a number or an array or a collection of some ...

How to Sum if Equal to X or Y in Excel
How to Sum if Equal to X or Y 19

In daily work, if we want to sum numbers from a range, and only sum the numbers which being equal to X or Y in the range, we can create a formula with Excel build-in functions to get the result. ...

How to Sum if Contains an Asterisk
How to Sum in Last N Days 14

In our daily life, we may want to sum amounts or sales for a specific period, for example in last N days. Sum numbers in Excel is easy to run, we can apply SUM function. But if we want to ...

How to Sum if Contains an Asterisk
How to Sum if Contains an Asterisk 7

To add numbers together we need to apply SUM function. And if we want to add numbers based on some conditions, we can add criteria with the help of SUMIFS function, SUMIFS can filter data with multiple criteria effectively. If ...

How to Sum in Vertical Range
How to Sum in Vertical Range 8

If we want to add numbers based on some conditions in Excel worksheet, we can add criteria with the help of SUMIFS function, SUMIFS can filter data with multiple criteria effectively. In this article, we will introduce you the method ...

How to Sum in Horizontal Range
How to Sum in Horizontal Range9

To add numbers together we need to apply SUM function. But if we want to add numbers based on some conditions, we can add criteria with the help of SUMIFS function, SUMIFS can filter data with multiple criteria effectively. In ...

How to Sum with Criteria and Or Logic in Excel
How to Sum with Criteria and Or Logic in Excel 8

To add numbers together we need to apply SUM function. And if we want to add numbers based on some conditions, we can add criteria with the help of SUMIFS function, SUMIFS can filter data with multiple criteria effectively. If ...

How to Subtotal Values for Groups and Only Keep One Subtotal for A Group in Column
How to Subtotal Values for Groups and Only Keep One Subtotal for A Group in Column14

Sometimes we may meet the case that subtotal values for different groups and only record a subtotal value for one group in a column, for other cells in this group, keep them blank. Today we will introduce you how can ...

How to Sum by Formula If Cells Are Not Blank in Criteria Range
How to Sum by Formula If Cells Are Not Blank in Criteria13

Sometimes we may meet the cases that some blank cells exist in criteria range or sum range. In most situations we will ignore them, so we need to filter data by ‘not blank/not empty’. Today we will introduce you how ...

How to Sum by Formula if Cell Ends with in Excel
How to Sum by Formula if Cell Ends with in Excel14

We have introduced the method of sum numbers based on criteria “sum if cell begins with” (you can refer to ‘How to Sum Data if Begins with in Excel’ on our website). In this article, we will show you the ...

Sidebar