Countifs Results Problem

rex759

Well-known Member
Joined
Nov 8, 2004
Messages
608
Office Version
  1. 365
Platform
  1. Windows
Hello,
I want to show the message “>3” for all dates involved if the date inputted falls between a 30 day period.

In the example below, I want the dates 2/1/16 & 2/22/16 to also show the message “>3” because they are part of the 4 dates that is causing the error.

Is there a better formula to show all dates involved than countifs to obtain these results?
Excel Workbook
ABC
1DateModeError
22/1/161
32/10/161>3
43/10/161
54/10/161
65/10/161
76/10/161
87/10/161
91/11/161
102/9/161>3
112/22/161
Sheet1
Excel 2010
Cell Formulas
RangeFormula
C2=IF(COUNTIFS($A$2:$A$11,">"&A2-15,$A$2:$A$11,"<"&A2+15,$B$2:$B$11,"="&B2)>3,">3","")
C3=IF(COUNTIFS($A$2:$A$11,">"&A3-15,$A$2:$A$11,"<"&A3+15,$B$2:$B$11,"="&B3)>3,">3","")
C4=IF(COUNTIFS($A$2:$A$11,">"&A4-15,$A$2:$A$11,"<"&A4+15,$B$2:$B$11,"="&B4)>3,">3","")
C5=IF(COUNTIFS($A$2:$A$11,">"&A5-15,$A$2:$A$11,"<"&A5+15,$B$2:$B$11,"="&B5)>3,">3","")
C6=IF(COUNTIFS($A$2:$A$11,">"&A6-15,$A$2:$A$11,"<"&A6+15,$B$2:$B$11,"="&B6)>3,">3","")
C7=IF(COUNTIFS($A$2:$A$11,">"&A7-15,$A$2:$A$11,"<"&A7+15,$B$2:$B$11,"="&B7)>3,">3","")
C8=IF(COUNTIFS($A$2:$A$11,">"&A8-15,$A$2:$A$11,"<"&A8+15,$B$2:$B$11,"="&B8)>3,">3","")
C9=IF(COUNTIFS($A$2:$A$11,">"&A9-15,$A$2:$A$11,"<"&A9+15,$B$2:$B$11,"="&B9)>3,">3","")
C10=IF(COUNTIFS($A$2:$A$11,">"&A10-15,$A$2:$A$11,"<"&A10+15,$B$2:$B$11,"="&B10)>3,">3","")
C11=IF(COUNTIFS($A$2:$A$11,">"&A11-15,$A$2:$A$11,"<"&A11+15,$B$2:$B$11,"="&B11)>3,">3","")
 
right but if I change A11 to 2/22, I don't want to see anything.
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
" anything" you mean also in C2 & C10 ?
Do you want to check if A11 > 3 then C2 & C3 & C10 will show ">3" ?
 
Last edited:
Upvote 0
I know, confusing isnt it. If it's greater than 3, then I want to flag all 4 (or more) dates that is involved even though some of the dates may not be over the 15 days. Yes to the second question, I dont want to see any errors in C2-C10.
 
Upvote 0
Try this , change the red value to your last cell

=IF(COUNTIFS($A$2:$A$11,">"&$A$11-15,$A$2:$A$11,"<"&$A$11+15,$B$2:$B$11,"="&B2)<=3,0,IF(COUNTIFS($A$2:$A$11,">"&A2-15,$A$2:$A$11,"<"&A2+15,$B$2:$B$11,"="&B2)>3,">3",""))
 
Upvote 0
Looking at it again, I see its not logical to get the results that I want. Looking at the below example, is there a way to show the results I listed under "Dates involved"?
Excel Workbook
ABCDEFGH
1DateModeError#Dates involvedRange (-15)Date Range (+15)
22/1/16131/17/162/16/16
32/10/161>342/1, 2/10, 2/9 ,2/221/26/162/25/16
43/10/16112/24/163/25/16
54/10/16113/26/164/25/16
65/10/16114/25/165/25/16
76/10/16115/26/166/25/16
87/10/16116/25/167/25/16
91/11/161112/27/151/26/16
102/9/161>342/1, 2/10, 2/9, 2/221/25/162/24/16
112/22/16132/7/163/8/16
Sheet1
Excel 2010
Cell Formulas
RangeFormula
C2=IF(COUNTIFS($A$2:$A$11,">"&A2-15,$A$2:$A$11,"<"&A2+15,$B$2:$B$11,"="&B2)>3,">3","")
D2=COUNTIFS($A$2:$A$11,">"&A2-15,$A$2:$A$11,"<"&A2+15,$B$2:$B$11,"="&B2)
G2=SUM(A2-15)
H2=SUM(A2+15)
 
Upvote 0
If you want that all values will be in one cell, it's a VBA task...

You can try this in I2 and copy down .....Control+Shift+Enter not just Enter
=IFERROR(INDEX($A$3:$A$12,SMALL(IF($D$3:$D$12>=3,ROW($D$3:$D$12)-2,""),ROW(A1)),1),"")
 
Upvote 0
Suited to your recent example
=IFERROR(INDEX($A$2:$A$11,SMALL(IF($D$2:$D$11>=3,ROW($D$2:$D$11)-1,""),ROW(A1)),1),"")
 
Upvote 0
You beat to the punch. That works but I want it to list the results horizontal. I also added a different variable to the mix. In this instance, I want to show the site numbers involved if the corresponding cell in column D is >3. I thought I had it pulling the 2nd, 3rd & 4th occurrence but in this example, G3 should be 1120 and F10 should be 1120.

I appreciate your help in all of this.
Excel Workbook
ABCDEFGHIJK
1DateModeError#SitesSitesSitesSitesRange (-15)Date Range (+15)
22/1/161311111/17/162/16/16
32/10/161>3411121111111811191/26/162/25/16
43/10/161111132/24/163/25/16
54/10/161111143/26/164/25/16
65/10/161111154/25/165/25/16
76/10/161111165/26/166/25/16
87/10/161111176/25/167/25/16
91/11/1611111812/27/151/26/16
102/9/161>341119#VALUE!111111121/25/162/24/16
112/22/161311202/7/163/8/16
Sheet1
Excel 2010
Cell Formulas
RangeFormula
C2=IF(COUNTIFS($A$2:$A$11,">"&A2-15,$A$2:$A$11,"<"&A2+15,$B$2:$B$11,"="&B2)>3,">3","")
D2=COUNTIFS($A$2:$A$11,">"&A2-15,$A$2:$A$11,"<"&A2+15,$B$2:$B$11,"="&B2)
J2=SUM(A2-15)
K2=SUM(A2+15)
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
 
Upvote 0
Ok, I think I have it. I changed the array in F2 to =IF($D2>3,INDEX($E$2:$E$25,SMALL(IF($D$2:$D$25>=3,ROW($D$2:$D$25)-ROW($D$2)+1,ROW($D$25)+1),1),1),"")
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

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