count ifs with date range from date time field

Imran Azam

Board Regular
Joined
Mar 15, 2011
Messages
103
HI Guys

i am doing a count ifs statement on the example data below

Name
Stats
date
Alex
Qualified
30/03/2019 01:18:01
Alex
Qualified
01/04/2019 10:08:01
Alex
Not Qualified
30/04/2019 02:01:01
Alex
Qualified
29/04/2019 16:18:01
James
Not Qualified
26/001/2019 10:55:01

<tbody>
</tbody>


<colgroup><col><col><col></colgroup><tbody>
</tbody>

The logic i am using is count Name if name equals Alex and stats Qualified and date range is between 01/04/2019 and 30/04/2019 then count name and divide this by the count of name where name is alex and date range is between 01/04/2019 and 30/04/2019. the answer should be 2/3

from previous post io did i used the following formula but now the date field has date and time this doesnt work

=COUNTIFS(A2:A10,"Alex",B2:B10,"Qualified",C2:C10,">="&DATEVALUE("4/1/19"),C2:C10,"<="&DATEVALUE("4/30/19"))

can any one help me correct this formula?

thanks guys
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I think your formula is fine.. It may be an issue where your dates/times are reading as text and not a date value.
 
Upvote 0
This would give you a start... Highlight all of your date/time data and run this:
Code:
Sub Text2Date()

Dim cel As Range
Dim arr As Variant
Dim aDate As Variant


For Each cel In Selection
    arr = Split(cel.Value, " ")
    aDate = Split(arr(0), "/")
    'assuming date is in mm/dd/yyyy format
    cel = DateSerial(aDate(2), aDate(1), aDate(0)) + TimeValue(arr(1))
Next cel
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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