Solved

Help with CountIF

Posted on 2014-03-24
10
252 Views
Last Modified: 2014-03-25
How can I use the CountIF, for a range of values i.e. between 60 - 90 days, between 31 and 59 days, and less than 30?

Network secuirty disables macros, but VB works.
0
Comment
Question by:cfhasan1
  • 5
  • 4
10 Comments
 
LVL 23

Expert Comment

by:NBVC
ID: 39951265
Can you explain your data a bit?  Do you have multiple columns and want to find the difference in dates and then count?  Or is it something else?
0
 
LVL 39

Expert Comment

by:nutsch
ID: 39951310
60-90 days, for example
=countifs(A:A,">=60",A:A,"<90")

unles you're dealing with dates, in which case you could have
=countifs(A:A,"<=" & today()-60 ,A:A,">" & today()-90)
or, depending on whether it's 60 days in the future or in the past:
=countifs(A:A,">=" & today()+60 ,A:A,"<" & today()+90)

Thomas
0
 

Author Comment

by:cfhasan1
ID: 39951529
What I have an expiration date with a reenlistment process that should begin no later than (NLT) 6 months or 180 days prior.  The spreadsheet contains that data.  I want to have available a vector points 30,60, 90 days.  

So, yes I have multiple columns and want to find the difference in dates and then count? The Expiration date


SO, I basically need to calculate the following:

The number of days until Expiration in a colum (K14), countif based upon criteria in K14
1. 30 Days or less
2. Between 31 to 59 days
3.Between 60 and 90 days
4. Between 91 and 179
5. 180 days or more
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39951618
If you have a column of Dates, say column A2:A100 and your expiration date is in K14, then try:

=SUMPRODUCT(--(K14-$A$2:$A$100>0),--(K14-$A$2:$A$100<=30))

=SUMPRODUCT(--(K14-$A$2:$A$100>30),--(K14-$A$2:$A$100<=59))

=SUMPRODUCT(--(K14-$A$2:$A$100>60),--(K14-$A$2:$A$100<=90))

=SUMPRODUCT(--(K14-$A$2:$A$100>91),--(K14-$A$2:$A$100<=179))

=SUMPRODUCT(--(K14-$A$2:$A$100>180))

adjust ranges to suit, but don't use large (whole) columsn.
0
 

Author Comment

by:cfhasan1
ID: 39951735
I have attached the file so you seen what I'm trying better...I don't think I'm expressing myself very well...
125MXG-CSS-Personnel-Tracker-v1..xlsm
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 23

Expert Comment

by:NBVC
ID: 39953287
I am not sure why you used column C.

If you use column F or any other column of dates, then you get numeric result:

e.g. =SUMPRODUCT(--(M5-$F$14:$F$100>0),--(M5-$F$14:$F$100<=30))  gives 1.
0
 

Author Comment

by:cfhasan1
ID: 39953413
What I figured out is that I'm asking the wrong thing or I think I figured a better way that works for this process.

So, what I actually need is to do is if the the following:
1.  If current date is outside the 0-365 day range of ETS, say:6 Mo of ETS (Expiration Date), but NLT 90 Days of ETS
2. If the current dates is within the 0-365 day range of the ETS(Expiration Date), then countdown and say or show days: ## Days
3.  If the expiration dates has passed, then say:  Please validate ETS status of member

=IF(B14>(B14-180),"6 Mo of ETS, but NLT 90 Days of ETS",IF(TODAY()<= B14-180,TODAY()-B14&" Days Remaining to ETS",""))
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39953458
Maybe something more like, in K14:

=IF(B14-$M$5<=180,IF(OR(B14-$M$5>=0,B14-$M$5>=-90),"6 Mo of ETS, but NLT 90 Days of ETS",""),IF($M$5<= B14-180,B14-$M$5&" Days Remaining to ETS",""))

copied down.
0
 

Author Comment

by:cfhasan1
ID: 39953665
Yes, I think we're on the right track here.  I'm closer to what I', looking for now.  But, maybe I'm still a little confused.  I've also attached spreadsheet with

I miss spoke or type, if the ETS (Expiration date) is out that 0-365 day range, then , say: 6 Mo of ETS (Expiration Date), but NLT 90 Days of ETS

2.But, If the expiration date is within the 0-365 day range of the ETS(Expiration Date), then countdown and say or show days: ##
 
3.  If the expiration dates has passed, then say:  Please validate ETS status of member
0
 
LVL 23

Accepted Solution

by:
NBVC earned 500 total points
ID: 39953675
If you are saying "6 mo of ETS....", then why is the check range 365 days (which would be 12 mo of ETS"?

Other than that, the formula for 6 months (~180 days) is:


=IF(B14-$M$5<=180,IF(OR(B14-$M$5>=0,B14-$M$5>=-90),"6 Mo of ETS, but NLT 90 Days of ETS","Please validate ETS status of member"),IF($M$5<= B14-180,B14-$M$5&" Days Remaining to ETS",""))

If you really mean 365 days, then:

=IF(B14-$M$5<=365,IF(OR(B14-$M$5>=0,B14-$M$5>=-90),"12 Mo of ETS, but NLT 90 Days of ETS","Please validate ETS status of member"),IF($M$5<= B14-365,B14-$M$5&" Days Remaining to ETS",""))
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sum iF  based on a null cell 11 29
Excel VBA - merge "specific" data from workbook in to "new" workbook. 19 24
Filling Blank Cells 14 21
simple vba query 9 23
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Companies keep a much closer eye on costs today, so changing to new Technology – Microsoft Office 365 is the smartest move to take.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now