+ Reply to Thread
Results 1 to 4 of 4

Using date fields as reference with COUNTIFS?

Hybrid View

dubcap01 Using date fields as... 10-20-2015, 05:11 AM
Sam Capricci Re: Using date fields as... 10-20-2015, 05:25 AM
Pete_UK Re: Using date fields as... 10-20-2015, 05:26 AM
dubcap01 Re: Using date fields as... 10-20-2015, 05:28 AM
  1. #1
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Using date fields as reference with COUNTIFS?

    Hi all,

    Attached is example workbook with two instances of what I thought might yield the same result.
    In the tab SUMDATA, I am trying to use the dates in rows 2 and 3 as the reference for a COUNTIFS.

    For the column with the dates for April 2015 ( the result in D4), the formula works fine with this reference:
    =COUNTIFS(COHORT!$C:$C,">=1/4/15",COHORT!$C:$C,"<=30/4/15")
    but that means I have to reference the start and end dates manually. I'd like a solution like the one in the column for March 2015 (the result in cell C4), for which this code doesn't work:
    =COUNTIFS(COHORT!$C:$C,"C2",COHORT!$C:$C,"C3")
    Does anyone know a way to reference cells C2 and C3 to be part of the criteria for COUNTIFS?

    Hope that makes sense!

    cheers
    Pete
    Attached Files Attached Files
    Pete
    Struggling Solutions Architect

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,690

    Re: Using date fields as reference with COUNTIFS?

    I'm having trouble finding the formulas you referenced above in your attached sheet.
    but in general if you change this...=COUNTIFS(COHORT!$C:$C,">=SUMDATA!D2",COHORT!$C:$C,"<=SUMDATA!D3")
    to this... =COUNTIFS(COHORT!$C:$C,">="&SUMDATA!D2,COHORT!$C:$C,"<="&SUMDATA!D3)
    it will work.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: Using date fields as reference with COUNTIFS?

    Remove the quotes from around C2 and C3 in your second formula. If you put them in the function will take the literal string "C2", instead of the contents of C2. You also need comparison operators, so the formula should probably be something like:

    =COUNTIFS(COHORT!$C:$C,">="&C2,COHORT!$C:$C,"<"&C3)

    Hope this helps.

    Pete

  4. #4
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Using date fields as reference with COUNTIFS?

    Thanks Pete,

    Your suggestion worked great! Problem solved!

    cheers
    Pete

+ 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. [SOLVED] Countifs with Row reference
    By nickmessick1 in forum Excel General
    Replies: 3
    Last Post: 05-14-2015, 07:45 PM
  2. countifs not working with cell reference
    By Trig79 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-18-2013, 07:07 AM
  3. Countifs with reference String along with criteria
    By boscoamd in forum Excel General
    Replies: 2
    Last Post: 11-30-2011, 04:59 AM
  4. COUNTIFS is counting my blank, text fields
    By Hoosaskin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2011, 01:14 PM
  5. Countifs to get criteria from a cell reference
    By SeanKosmann in forum Excel General
    Replies: 2
    Last Post: 01-27-2011, 11:00 AM
  6. Making countifs reference inequalities
    By mremmenga in forum Excel General
    Replies: 1
    Last Post: 10-22-2008, 05:42 PM
  7. [SOLVED] Excel SHOULD NOT AUTO-CHANGE formated text fields to DATE FIELDS!
    By PSSSD in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-08-2006, 04:35 PM

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