+ Reply to Thread
Results 1 to 4 of 4

Countif formula to count based on the timeframe indicate on cell

  1. #1
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    Countif formula to count based on the timeframe indicate on cell

    Hi,

    I have a sum product formula which i have in the attached worksheet in the tab named tally. It counts accurately based on the criteria that are set. However it counts based on only the current month and i would like to consolidate all the monthly worksheets in a single worksheet which can present the tally on toggling the period. I have created a list using data validation in the same worksheet to be able to toggle between months, quarter and the year.

    The help that i require is for the formula to count based on the period data that is in cell H1 and count the sum products of the criteria (Columns A:D) in the database tab. I have a created a sample on the worksheet to show some expected results.
    Attached Files Attached Files

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Countif formula to count based on the timeframe indicate on cell

    Not sure if you want to add to existing formulas, or create a new one for the dates, but this is the conditional criteria you need to put in a SUMPRoduCT

    (YEAR(H1)=YEAR(Database!$B$2:$B$1000))*(MONTH(H1)=MONTH(Database!$B$2:$B$1000))

  3. #3
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Countif formula to count based on the timeframe indicate on cell

    My formula is:

    Please Login or Register  to view this content.
    Note that copying this down one row will change $B2 to $B3 but that's not correct for your table format so I had to make a change on the second row. Doing the quarters and entire year in the same formula was overly complex so I moved those calculations to separate columns with separate drop-down lists. See attached.

    WBD
    Attached Files Attached Files
    Office 365 on Windows 11, looking for rep!

  4. #4
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    Re: Countif formula to count based on the timeframe indicate on cell

    Thank you. This worked.

+ 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] Cell shading based on timeframe.
    By Jchiaren in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-19-2019, 05:30 PM
  2. Replies: 1
    Last Post: 07-08-2016, 01:22 AM
  3. COUNTIF Formula based on cell formatting
    By telton in forum Excel General
    Replies: 7
    Last Post: 06-12-2014, 08:00 AM
  4. Lookup formula based on a condition and date timeframe
    By rmitri in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-14-2013, 01:56 PM
  5. VLOOKUP based on date in specific timeframe
    By 4134x4nd3r in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-18-2013, 05:10 PM
  6. Replies: 3
    Last Post: 12-21-2012, 05:33 AM
  7. Help Please!! Cell to change colour if timeframe exceeded based on several choices
    By Fran Habbitts in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 05:56 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