Home » excel » excel – Google Spreadsheet COUNTIF TODAY()?

excel – Google Spreadsheet COUNTIF TODAY()?

Posted by: admin March 9, 2020 Leave a comment

Questions:

Is there any way to COUNTIF it’s the current date?

For example I have a spreadsheet with work orders, once the employee starts the work order it captures a time stamp, after the work order is completed it is moved to an archive, well I wanted to create a summary sheet that tells me how many orders we have done for that date, the format of the time stamp is:

2/19/2014 17:10:20

So basically I need a COUNTIF to count the column for the current date.

Is this possible?

How to&Answers:

You would need to apply a function first on the range, which then makes COUNTIF not an appropriate function to count those dates matching ‘today’. You can use SUMPRODUCT instead:

=arrayformula(SUMPRODUCT(1*(INT(A1:A100)=TODAY())))

INT strips out the time from the datetime.

Answer:

The new version of Google Sheets has COUNTIFS, which would allow =COUNTIFS(A:A,">="&TODAY(),A:A,"<"&TODAY()+1)

You need to opt in to the new version to make it work, though. (“Try the new Google Sheets”)

Answer:

If you don’t have COUNTIFS available, as per maybeWeCouldStealAVan's suggestion, then you can use two COUNTIF functions like this

=COUNTIF(A:A,">="&TODAY())-COUNTIF(A:A,">="&TODAY()+1)

by counting all entries greater than or equal to today then subtracting all those greater than or equal to tomorrow the result is a count of those on today’s date only

That formula will work in Excel or google – another option, similar to Jerry’s is to use this googledocs specific formula

=count(filter(A1:A100,int(A1:A100)=today()))

Answer:

try this:

    dim i as integer
    dim objDate as date
    dim objStartDate as Date
    dim objEndDate as Date
    dim countOrders as integer

    countOrders = 1
    objStartDate = 'the start date to check with ( could be the start of the day)
    objEndDate = 'the end date to check with (could be the end of the day)

    for i = 1 to 'number of rows
        objDate = CDate(cells(i, 1))
        if (objDate > objStartDate) and (objDate < objEndDate) then
            countOrders = countOrder +1
        end if
    next i