+ Reply to Thread
Results 1 to 6 of 6

CountIf or SumIf? Counting text values in a specific date range

  1. #1
    Registered User
    Join Date
    05-04-2015
    Location
    NH
    MS-Off Ver
    Office 365
    Posts
    28

    CountIf or SumIf? Counting text values in a specific date range

    Is it possible for me to use CountIf or SumIf in Excel for this use case?

    I would like to count the number of occurrences of "ACTIVITY_CREATE_USER" (in my Action column) for the last 30 days.

    I have an "Action" column and a "ActivityTime.Date" column.

    Sample data sheet attached:
    SampleValues.xlsx

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: CountIf or SumIf? Counting text values in a specific date range

    Hi, welcome to the forum

    Try this...
    =COUNTIFS($A$2:$A$28,"ACTIVITY_CREATE_USER",$B$2:$B$28,">="&TODAY()-30,$B$2:$B$28,"<="&TODAY())
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: CountIf or SumIf? Counting text values in a specific date range

    Try this

    =COUNTIFS(B2:B28,">="&MAX(B2:B28)-30,B2:B28,"<="&MAX(B2:B28),A2:A28,"ACTIVITY_CREATE_USER")
    Last edited by AlKey; 05-04-2015 at 06:51 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: CountIf or SumIf? Counting text values in a specific date range

    Quote Originally Posted by AlKey View Post
    Try this

    =COUNTIFS(B2:B28,">="&MAX(B2:B28)-30,B2:B28,"<="&MAX(B$2:B28),A2:A28,"ACTIVITY_CREATE_USER")
    Good catch. I was thinking within the last 30 days from today - which is not necessarily the case

  5. #5
    Registered User
    Join Date
    05-04-2015
    Location
    NH
    MS-Off Ver
    Office 365
    Posts
    28

    Re: CountIf or SumIf? Counting text values in a specific date range

    Thanks Ford. This works great. How could I modify this formula to apply to two use cases (below)?
    1. Returning visitors (at least 1 login from previous 30 days). I imagine I would just need to modify your formula to check against a new "username" column and limit records to one login only.
    2. New visitors (at least one login from someone that has not signed in before (all time)). Also checking against a third "username" column.

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: CountIf or SumIf? Counting text values in a specific date range

    Another possibility is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ 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. Using =SUMIF,=COUNTIF, and =AVERAGE to find specific values in columns
    By ExcelNub83 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-07-2015, 07:53 PM
  2. Replies: 8
    Last Post: 02-21-2012, 11:11 AM
  3. countif - counting too much (text values)
    By przemke in forum Excel General
    Replies: 3
    Last Post: 08-07-2009, 04:03 AM
  4. Counting values for specific text
    By Analyst123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-08-2008, 05:08 PM
  5. Replies: 11
    Last Post: 01-24-2007, 04:25 AM

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