COUNTIFS formula.

Kayslover

Board Regular
Joined
Sep 22, 2020
Messages
176
Office Version
  1. 2013
Platform
  1. Windows
I have a membership spreadsheet (STO Members) that details when members paid their club subscription alongside the statement number that their payment shows on. This data is in columns B and C.

On another sheet called “Supporting Paid Print” the statement number and paid dated is copied by means of a VLOOKUP.

I am trying to count the number of payments received in sheet Supporting Paid Print that have been paid in Jan, Feb, Mar etc. and I have the total in Row 60.

I am using the formula =COUNTIFS(C3:C52,F3:F52,">="&Formula!D2,C3:C52,F3:F52,"<="&Formula!E2) but I keep getting the following error which I cannot work out.

I have tried the above formula but as follows and I get the same error

=COUNTIFS(C3:C52,F3:F52,">="&Formula!&D2,C3:C52,F3:F52,"<="&Formula!&E2)

View attachment 111866

Any assistance given to resolve this error would be appreciated.

Sample data included.
2024 Membership - Copy.xlsm
ABCDEFGH
1Membership NumberPayment Statement numberPayment Received DateSurnameFirst NameAddressTownPost Code
2SM0000144801/01/24Surname 1First Name 1Address 1Town 1Post Code 1
3SM0000244802/01/24Surname 2First Name 2Address 2Town 2Post Code 2
4SM0000344912/01/24Surname 3First Name 3Address 3Town 3Post Code 3
5SM0000445010/02/24Surname 4First Name 4Address 4Town 4Post Code 4
6SM0000544701/04/24Surname 5First Name 5Address 5Town 5Post Code 5
7SM0000644703/04/24Surname 6First Name 6Address 6Town 6Post Code 6
8SM0000721602/11/24Surname 7First Name 7Address 7Town 7Post Code 7
9SM0000845001/05/24Surname 8First Name 8Address 8Town 8Post Code 8
10SM0000945004/05/24Surname 9First Name 9Address 9Town 9Post Code 9
11SM0001044901/06/24Surname 10First Name 10Address 10Town 10Post Code 10
12SM0001144910/06/24Surname 11First Name 11Address 11Town 11Post Code 11
13SM0001244901/07/24Surname 12First Name 12Address 12Town 12Post Code 12
14SM0001344910/07/24Surname 13First Name 13Address 13Town 13Post Code 13
15SM0001450010/08/24Surname 14First Name 14Address 14Town 14Post Code 14
16SM0001550010/08/24Surname 15First Name 15Address 15Town 15Post Code 15
17SM0001652301/09/24Surname 16First Name 16Address 16Town 16Post Code 16
18SM0001756329/09/24Surname 17First Name 17Address 17Town 17Post Code 17
19SM0001860301/10/24Surname 18First Name 18Address 18Town 18Post Code 18
20SM0001964310/10/24Surname 19First Name 19Address 19Town 19Post Code 19
21SM0002068310/10/24Surname 20First Name 20Address 20Town 20Post Code 20
22SM0002172301/11/24Surname 21First Name 21Address 21Town 21Post Code 21
23SM0002276309/11/24Surname 22First Name 22Address 22Town 22Post Code 22
24SM0002380311/11/24Surname 23First Name 23Address 23Town 23Post Code 23
25SM0002484301/12/24Surname 24First Name 24Address 24Town 24Post Code 24
26SM0002588305/12/24Surname 25First Name 25Address 25Town 25Post Code 25
27SM0002692305/12/24Surname 26First Name 26Address 26Town 26Post Code 26
28SM00027Surname 27First Name 27Address 27Town 27Post Code 27
29SM00028Surname 28First Name 28Address 28Town 28Post Code 28
30SM00029Surname 29First Name 29Address 29Town 29Post Code 29
31SM0003062801/01/24Surname 30First Name 30Address 30Town 30Post Code 30
32SM00031Surname 31First Name 31Address 31Town 31Post Code 31
33SM00032Surname 32First Name 32Address 32Town 32Post Code 32
34SM00033Surname 33First Name 33Address 33Town 33Post Code 33
35SM00034Surname 34First Name 34Address 34Town 34Post Code 34
36SM00035Surname 35First Name 35Address 35Town 35Post Code 35
37SM0003662801/01/24Surname 36First Name 36Address 36Town 36Post Code 36
38SM00037Surname 37First Name 37Address 37Town 37Post Code 37
STO Members



2024 Membership - Copy.xlsm
ABCDEFGHI
1Supporting Members Paid Print
2M/Ship NoStatement NoPaid DateM/Ship NoStatement NoPaid DateM/Ship NoStatement NoPaid Date
3SM0000144801/01/24SM00051  SM00101  
4SM0000244802/01/24SM00052  SM00102  
5SM0000344912/01/24SM00053  SM00103  
6SM0000445010/02/24SM00054  SM00104  
7SM0000544701/04/24SM00055  SM00105  
8SM0000644703/04/24SM00056  SM00106  
9SM0000721602/11/24SM00057  SM00107  
10SM0000845001/05/24SM00058  SM00108  
11SM0000945004/05/24SM00059  SM00109  
12SM0001044901/06/24SM00060  SM00110  
13SM0001144910/06/24SM00061  SM00111  
14SM0001244901/07/24SM00062  SM00112  
15SM0001344910/07/24SM00063  SM00113  
16SM0001450010/08/24SM00064  SM00114  
17SM0001550010/08/24SM00065  SM00115  
18SM0001652301/09/24SM00066  SM00116  
19SM0001756329/09/24SM00067  SM00117  
20SM0001860301/10/24SM00068  SM00118  
21SM0001964310/10/24SM00069  SM00119  
22SM0002068310/10/24SM00070  SM00120  
23SM0002172301/11/24SM00071  SM00121  
24SM0002276309/11/24SM00072  SM00122  
25SM0002380311/11/24SM00073  SM00123  
26SM0002484301/12/24SM00074  SM00124  
27SM0002588305/12/24SM00075  SM00125  
28SM0002692305/12/24SM00076  SM00126  
29SM00027  SM00077  SM00127  
30SM00028  SM00078  SM00128  
31SM00029  SM00079  SM00129  
32SM0003062801/01/24SM00080  SM00130  
33SM00031  SM00081  SM00131  
34SM00032  SM00082  SM00132  
35SM00033  SM00083  SM00133  
36SM00034  SM00084  SM00134  
37SM00035  SM00085  SM00135  
38SM0003662801/01/24SM00086  SM00136  
39SM00037  SM00087  SM00137  
40SM00038  SM00088  SM00138  
41SM00039  SM00089  SM00139  
42SM00040  SM00090  SM00140  
43SM00041  SM00091  SM00141  
44SM00042  SM00092  SM00142  
45SM00043  SM00093  SM00143  
46SM00044  SM00094  SM00144  
47SM00045  SM00095  SM00145  
48SM00046  SM00096  SM00146  
49SM00047  SM00097  SM00147  
50SM00048  SM00098  SM00148  
51SM00049  SM00099  SM00149  
52SM00050  SM00100  SM00150  
53
54Column Count28280000
55
56There is 1 person who made a payment on the 13/4/24 which did not have any reference number
57
58Total Number of Paid Members28
59Paid In JanPaid In FebPaid In MarPaid In AprPaid In MayPaid In JunePaid In JulyPaid In AugPaid In Sept
60
Supporting Paid Print
Cell Formulas
RangeFormula
H3:H52,E3:E52,B3:B52B3=IF(VLOOKUP(A3,'STO Members'!$A$2:$C$203,2,FALSE)=0,"",VLOOKUP(A3,'STO Members'!$A$2:$C$203,2,FALSE))
I3:I52,F3:F52,C3:C52C3=IF(VLOOKUP(A3,'STO Members'!$A$2:$C$203,3,FALSE)=0,"",VLOOKUP(A3,'STO Members'!$A$2:$C$203,3,FALSE))
H54:I54,E54:F54,B54:C54B54=COUNTIF(B3:B52,">0")
E58E58=B54+E54+H54+K54


2024 Membership - Copy.xlsm
ABCDE
1Processing Year202424Month Start DateMonth End Date
2Start of Year01/01/24January01/01/2431/01/24
3February02/01/2429/02/24
4March03/01/2431/03/24
5April04/01/2430/04/24
6May05/01/2431/05/24
7June06/01/2430/06/24
8July07/01/2431/07/24
9August08/01/2431/08/24
10September09/01/2430/09/24
11October10/01/2431/10/24
12November11/01/2430/11/24
13December12/01/2431/12/24
Formula
Cell Formulas
RangeFormula
C1C1=RIGHT(B1,2)
B2B2=CONCATENATE("01/","01/",$C$1)
D2D2=$B$2-DAY($B$2)+1
E2E2=EOMONTH($B$2,0)
D3D3=$B$2-DAY($B$2)+2
E3E3=EOMONTH($B$2,1)
D4D4=$B$2-DAY($B$2)+3
E4E4=EOMONTH($B$2,2)
D5D5=$B$2-DAY($B$2)+4
E5E5=EOMONTH($B$2,3)
D6D6=$B$2-DAY($B$2)+5
E6E6=EOMONTH($B$2,4)
D7D7=$B$2-DAY($B$2)+6
E7E7=EOMONTH($B$2,5)
D8D8=$B$2-DAY($B$2)+7
E8E8=EOMONTH($B$2,6)
D9D9=$B$2-DAY($B$2)+8
E9E9=EOMONTH($B$2,7)
D10D10=$B$2-DAY($B$2)+9
E10E10=EOMONTH($B$2,8)
D11D11=$B$2-DAY($B$2)+10
E11E11=EOMONTH($B$2,9)
D12D12=$B$2-DAY($B$2)+11
E12E12=EOMONTH($B$2,10)
D13D13=$B$2-DAY($B$2)+12
E13E13=EOMONTH($B$2,11)
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Your structure for the formula is wrong. COUNTIFS needs pairs of ranges and criteria. Your C3:C52 references don't have any corresponding criteria.
 
Upvote 0
RoryA,

The error is :-

1716550493311.png
 
Upvote 0
You have too many arguments, maybe
Excel Formula:
=COUNTIFS(C3:C52,F3:F52,">="&Formula!D2,F3:F52,"<="&Formula!E2)
 
Upvote 0
Sorry - I edited my post above after taking a closer look at your formula.
 
Upvote 0
RoryA,

Thank you for your comments about the Structure of the formula being wrong.

Basically what I am trying to do is check the range in C3:C53, F3:F53,I3:I53, L3:L53 and O3:O53 (all headed Paid Date” and have a formula in A60 that counts all dates for Jan, B61 that counts all dates in Feb (I would change the reference to Formula!D2 to E2..) C61 that counts all dates in Mar etc. etc etc.

Is it possible to replace the incorrect formula with some other formula that would give me the desired result?
 
Upvote 0
Looking at your data, you could probably get away with checking all cells in the entire range against those dates:

Excel Formula:
=COUNTIFS(C3:O53,">="&Formula!D2,C3:O53,"<="&Formula!E2)

unless your statement numbers are likely to go into the 45k range?

Slightly safer option might be something like:

Excel Formula:
=SUMPRODUCT((C3:O53>=Formula!D2)*(C3:O53<=Formula!E2)*(C2:O2="Paid Date"))
 
Upvote 0
Hi Kayslover

Pls try countifs(C3:C52,">="&Formula!$D$2,C3:C52,"<="&Formula!$E$2)

This counts those entries in C3 to C52, which fall in the range FormulaD2 to FormulaE2 (ie, Jan 2024)

For Feb month, pls try countifs(F3:F52,">="&Formula!$D$3,F3:F52,"<="&Formula!$E$3) and so on

Please do let know if this has been of help

Thanks
 
Upvote 0
RoryA,

Thank you for the above, I appreciate your time and effort.

I will have a look at your recommendation over the weekend and come back to you. (I have a planned dentist appointment and have therefore got to disappear.
 
Upvote 0
Arun,

Thank you for your assistance.

I will have a look at your recommendation over the weekend and come back to you. (I have a planned dentist appointment and have therefore got to disappear.
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

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