+ Reply to Thread
Results 1 to 11 of 11

Use COUNTIFS function on results of DATEVALUE function?

  1. #1
    Registered User
    Join Date
    08-02-2009
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2007
    Posts
    84

    Use COUNTIFS function on results of DATEVALUE function?

    Hi all

    Thanks in advance.

    I have taken over a workbook with 1800 rows of data, it is populated with the day, month & year in columns D,E & F, then in column B the DATEVALUE function has been used to combine the three into a standard format date DD/MM/YYYY, the also in column A the WEEKDAY function has been used to calculate the day of the week.

    Now i need to produce some stats using the COUNTIFS function based on data between two dates, i've been trying to use the dates from column B (the DATEVALUE results) but cant get it to work.

    Is there any way of converting it / make it work without re inputting 1800 dates manually?

    Please find a sample attached.

    Regards

    SiSample.xlsx

  2. #2
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Use COUNTIFS function on results of DATEVALUE function?

    What exactly are you trying to count? Is it the number of D-I/D (Assist or Direct) between the start and stop dates on Sheet1?
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Use COUNTIFS function on results of DATEVALUE function?

    I see a worksheet.
    I see it has parts of dates in columns D E F
    I see they are combined in column B.

    I see in your description you say you have been using COUNTIFs to produce "some stats".
    But I dont see a COUNTIF anywhere in that worksheet.

    So you'll need to explain further what you're trying to achieve.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Use COUNTIFS function on results of DATEVALUE function?

    This will count how many dates exist between the 2 dates in sheet1
    =COUNTIFS(Prisoners!B:B,">="&B1,Prisoners!B:B,"<="&B2)

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Use COUNTIFS function on results of DATEVALUE function?

    Hi Si,

    First you will need to find the bad dates and missing dates in your data so each has a valid date. Then I assume you want some kind of counts per the between dates. See the attached Pivot Table where I've done that using Excel 2013. I believe it is also possible in 2007 but think you can do it. ALSO - you will need to add column headers to each column so Excel can deal with your data as a table. Duplicate head names or missing head names aren't allowed. See the attached and start looking at Pivots for a possible answer.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Registered User
    Join Date
    08-02-2009
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Use COUNTIFS function on results of DATEVALUE function?

    Quote Originally Posted by mcmahobt View Post
    What exactly are you trying to count? Is it the number of D-I/D (Assist or Direct) between the start and stop dates on Sheet1?
    Quote Originally Posted by Special-K View Post
    I see a worksheet.
    I see it has parts of dates in columns D E F
    I see they are combined in column B.

    I see in your description you say you have been using COUNTIFs to produce "some stats".
    But I dont see a COUNTIF anywhere in that worksheet.

    So you'll need to explain further what you're trying to achieve.
    Quote Originally Posted by Jonmo1 View Post
    This will count how many dates exist between the 2 dates in sheet1
    =COUNTIFS(Prisoners!B:B,">="&B1,Prisoners!B:B,"<="&B2)
    Quote Originally Posted by MarvinP View Post
    Hi Si,

    First you will need to find the bad dates and missing dates in your data so each has a valid date. Then I assume you want some kind of counts per the between dates. See the attached Pivot Table where I've done that using Excel 2013. I believe it is also possible in 2007 but think you can do it. ALSO - you will need to add column headers to each column so Excel can deal with your data as a table. Duplicate head names or missing head names aren't allowed. See the attached and start looking at Pivots for a possible answer.
    Thanks all for your responses.

    Sorry i should have realised you need some indication of what im trying to achieve, I've re attached a sample.

    On sheet 2 row 5 columns B:G i have put in the functions / formulas i have tried to use to no avail.

    I need to count the number of times a name exists in sheet1 G:H based on the dates entered in Sheet2 B1 & B2.

    Also, the same including if the criteria Direct / Assist / Pro Active appears against the name, and Front or Back.

  7. #7
    Registered User
    Join Date
    08-02-2009
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Use COUNTIFS function on results of DATEVALUE function?

    Sorry wouldn't let me attach for some reason.


    Sample 1.xlsx

  8. #8
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Use COUNTIFS function on results of DATEVALUE function?

    If I interpreted this correctly, you could try this in C5 and drag across/down:

    Please Login or Register  to view this content.
    3

    However, note that Front and Back will both always return zero values because they are not a criteria listed within column L on Sheet1.

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Use COUNTIFS function on results of DATEVALUE function?

    Try this

    In C5 and filled accross/down to E11
    =SUMPRODUCT(('Sheet 1'!$G$2:$H$48=$A5)*('Sheet 1'!$L$2:$L$48=C$4)*('Sheet 1'!$B$2:$B$48>=$B$1)*('Sheet 1'!$B$2:$B$48<=$B$2))

    In B5 and filled down
    =SUM(C5:E5)

  10. #10
    Registered User
    Join Date
    08-02-2009
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Use COUNTIFS function on results of DATEVALUE function?

    Thanks mcmahobt but doesn't seem to work either, just returns 0.

    Not sure why the DATEVALUE results would prevent counting between dates, or am i missing something?

  11. #11
    Registered User
    Join Date
    08-02-2009
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Use COUNTIFS function on results of DATEVALUE function?

    Quote Originally Posted by Jonmo1 View Post
    This will count how many dates exist between the 2 dates in sheet1
    =COUNTIFS(Prisoners!B:B,">="&B1,Prisoners!B:B,"<="&B2)
    Thanks Jonmo1

    I get that far and succesfully count the dates, however as soon as i enter another Range and criteria to count it returns 0.

    i.e count all entries between the two dates as above, but only if the name in Sheet2 Cell A5 appears in Sheet1 G:H.

    Then i need to add further criteria to the above, i.e count the number of times a name appears in Sheet1 G:H between the two dates with an entry "Direct" against it in Sheet1 L:L

    Please see new attachment "Sample1" at post #7.

    I know this seems quite simple in theory but i just can't get it to work.

    All your help is much appreciated

    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Datevalue function
    By vioravis in forum Excel General
    Replies: 3
    Last Post: 01-19-2009, 09:45 AM
  2. [SOLVED] Conditional Sum and DATEVALUE function
    By RagDyeR in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 06:05 AM
  3. Conditional Sum and DATEVALUE function
    By Vlad in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  4. Conditional Sum and DATEVALUE function
    By Vlad in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-14-2005, 12:05 PM
  5. [SOLVED] Using DateValue function
    By Ralph Elmerick in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-11-2005, 04:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1