+ Reply to Thread
Results 1 to 10 of 10

Only count cells with any one of each of several separate values, on dates before today

  1. #1
    Registered User
    Join Date
    08-21-2020
    Location
    MacQuarrie Island
    MS-Off Ver
    16
    Posts
    11

    Only count cells with any one of each of several separate values, on dates before today

    I've got dates heading up columns, ranging from past to future containing data for the year to date.

    The number of instances of certain values on each date and on all dates cumulatively, needs to be counted as the data appear, moving through the year.

    So far, the formula used has been

    =COUNTIF(F3:F6,"ball")

    But this returns zero values for future dates, which skews the averages.

    What formula will only count the values on dates before today such that as soon as new data arrives for each date, the counts will change and the new percentages and averages be calculated?

    Then the averages formula can calculate only cells with values. I'd appreciate help with that as well. Confused with syntax, trying to use IF, COUNTIF and other functions that I can't seem to make work in combination.

    Including a picture as well, so you can see at a glance before opening the also attached worksheet.

    excelprob.jpg
    Attached Files Attached Files
    Last edited by Eusr; 04-26-2021 at 03:12 AM.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.85 (24051214))
    Posts
    8,833

    Re: Only count cells with any one of each of 4 separate values, on dates before today

    countifs()
    averageifs()

    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    Not sure, does this go some way to a solution
    Attached Files Attached Files
    Last edited by etaf; 04-25-2021 at 08:33 AM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    08-21-2020
    Location
    MacQuarrie Island
    MS-Off Ver
    16
    Posts
    11

    Re: Only count cells with any one of each of several discrete values on dates before today

    Many thanks Wayne. It seems the countifs is working, and leaving the percentages as simply =IF(F10="","",F10/4) does the trick once the countifs make for the needed blank cells.

    But I'm confused; why COUNTIFS and that outlier B10? I tried making it simply COUNTIF with the range F3:F6 and there was a 'too few arguments' error.

    What am I missing?
    Last edited by Eusr; 04-26-2021 at 03:14 AM.

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.85 (24051214))
    Posts
    8,833

    Re: Only count cells with any one of each of 4 separate values, on dates before today

    countifs() allows more than 1 criteria , so we can check the dates as well

    the B10 - looks at the criteria , so BALL
    you can go back to using "Ball" if prefer
    Just by using the B10 - then if you change that column for different criteria , you dont need to type it in
    BUT
    =IF(C$2<=TODAY(),COUNTIF(C$3:C$6,$B10),"")
    COUNTIF works as there is only 1 criteria

    Also using the "" in dates for the future
    Then average should also now work rather than averageifs()
    As instead of zero we now have the blanks

    lots of different ways to approach
    Here is the IF(using a blank ) using a countif & as now blank you can change to average()
    Attached Files Attached Files
    Last edited by etaf; 04-25-2021 at 09:10 AM.

  5. #5
    Registered User
    Join Date
    08-21-2020
    Location
    MacQuarrie Island
    MS-Off Ver
    16
    Posts
    11

    Red face Re: Only count cells with any one of each of several discrete values on dates before today

    Quote Originally Posted by etaf View Post
    countifs() allows more than 1 criteria , so we can check the dates as well

    the B10 - looks at the criteria , so BALL
    you can go back to using "Ball" if prefer
    Just by using the B10 - then if you change that column for different criteria , you dont need to type it in
    BUT
    =IF(C$2<=TODAY(),COUNTIF(C$3:C$6,$B10),"")
    COUNTIF works as there is only 1 criteria

    Also using the "" in dates for the future
    Then average should also now work rather than averageifs()
    As instead of zero we now have the blanks

    lots of different ways to approach
    Here is the IF(using a blank ) using a countif & as now blank you can change to average()
    Yes, I see. Rookie had forgotten that the formula contains a cell reference and not a value, unless said value is wrapped in double quotes.
    Anyway I have plugged your formula into all future and past dates, and all is working well.

    I'm going to recreate part of the actual table and post it here in hopes it may assist someone else someday.

    The formula I've started with is

    Please Login or Register  to view this content.
    , attempted to be adapted from your
    Please Login or Register  to view this content.
    From there it's been copied throughout the table. Set the absolute cell refs correctly, it seems.

    I had trouble with this; it seemed the formula wasn't working on being pasted into cells under past dates.

    By chance I stumbled on the solution; in anonymising the Example table I changed the dates. Doing this caused a change in the formatting I don't quite comprehend, as they were already in 'date' format...but anyway the look of the dates in the date row changed from d/m to dd/mm/yy, and after this the formula worked in all past dates.

    Thanks, etaf! Yam ruoy etaf eb yppah.

    PS there are handy sites that generate random lists of names or other words. That makes it easy to fill out a table with anonymous data. Search for 'random list of names/words', or 'random name/word generator'.
    Attached Files Attached Files
    Last edited by Eusr; 04-26-2021 at 05:50 AM.

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.85 (24051214))
    Posts
    8,833

    Re: Only count cells with any one of each of several separate values, on dates before toda

    Glad its all now resolved for you
    Last edited by etaf; 04-26-2021 at 04:46 AM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,595

    Re: Only count cells with any one of each of several separate values, on dates before toda

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  8. #8
    Registered User
    Join Date
    08-21-2020
    Location
    MacQuarrie Island
    MS-Off Ver
    16
    Posts
    11

    Re: Only count cells with any one of each of several separate values, on dates before toda

    Will hit 'solved'.
    Re: rep; yep. I've done that already and was pleased to observe it can be done more than once!

  9. #9
    Registered User
    Join Date
    08-21-2020
    Location
    MacQuarrie Island
    MS-Off Ver
    16
    Posts
    11

    Thumbs up Re: Only count cells with any one of each of 4 separate values, on dates before today

    DEAR Wayne,

    After 6 months I've returned to this post and your answers to mine it for your second solution: the AVERAGEIFS one.

    I don't know how to thank you. You knew it would be needed!

    What an absolute champion, etaf.
    Last edited by Eusr; 10-15-2021 at 01:55 AM.

  10. #10
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.85 (24051214))
    Posts
    8,833

    Re: Only count cells with any one of each of several separate values, on dates before toda

    you are welcome

+ 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] Count data based on matching dates in 2 separate cells.
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-16-2017, 12:11 PM
  2. =count separate date & time and count dates inside or outside 30 days
    By Beret in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-16-2017, 10:26 AM
  3. Trying to count values for rows with dates within 3 months of today
    By designergav in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-26-2015, 07:28 AM
  4. Replies: 3
    Last Post: 04-03-2013, 02:35 PM
  5. [SOLVED] sort by date, show records with only dates less than 30 days from today, and count....
    By pbucc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2012, 12:11 PM
  6. Count dates after today?
    By jason7579 in forum Excel General
    Replies: 3
    Last Post: 08-27-2010, 05:43 AM
  7. Count the number of dates in a range that are earlier than today.
    By DeborahS in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-08-2005, 10:06 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