GOOGLE SHEETS: Counting total number of rows in the previous month

mdsurf

New Member
Joined
Aug 1, 2017
Messages
22
Office Version
  1. 2016
Platform
  1. MacOS
Hi! I'm trying to calculate the total number of rows that exist in the previous month based on the current date.

Here is an example

DateSubmission
1/12/2021Submission 1
12/27/2020Submission 2
12/13/2020Submission 3
11/20/2020Submission 4
11/03/2020Submission 5

Since we are currently in the month of january, I would like to know how many submissions there were in the month of December. When we get to February, I would like to calculate the total rows for January.

Is there an equation that can do this? If it makes any difference, I'll be using google sheets.

Thank you!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi MDSurf,

Does this work for you?

MDSurf.xlsx
ABCD
1DateSubmissionResult
21/12/2021Submission 12
312/27/2020Submission 2
412/13/2020Submission 3
511/20/2020Submission 4
611/3/2020Submission 5
Sheet1
Cell Formulas
RangeFormula
D2D2=COUNTIFS($A$2:$A$9999,">="&EOMONTH(TODAY(),-2)+1,$A$2:$A$9999,"<="&EOMONTH(TODAY(),-1))
 
Upvote 0
This formula work For all month except Jan.
Excel Formula:
=SUMPRODUCT(--(MONTH(I2:I9)=MONTH(TODAY())-1)*(J2:J9))
 
Upvote 0
Try this:
Excel Formula:
=SUMPRODUCT(--(MONTH(A2:A9)=IF(MONTH(TODAY())=1,12,MONTH(TODAY())-1))*(B2:B9))

Mail Generator2.xlsm
ABCDE
1DateStart Time
212/7/20204545
31/12/202156
41/12/202167
51/13/202178
61/14/202189
71/8/2021100
81/13/2021111
91/14/2021122
PL2001
Cell Formulas
RangeFormula
E2E2=SUMPRODUCT(--(MONTH(A2:A9)=IF(MONTH(TODAY())=1,12,MONTH(TODAY())-1))*(B2:B9))
Named Ranges
NameRefers ToCells
'PL2001'!Extract='PL2001'!$A$2:$A$2E2
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,428
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top