Excel How To Count Cells With Dates In Them

 admin  
Excel How To Count Cells With Dates In Them 5,5/10 1759 votes

Jan 30, 2019 - The COUNTIFS function was introduced in Excel 2007 and it works like the COUNTIF function except you may use multiple conditions at the. Count instances of a letter in a row if a certain cell in that row contains a specified date 0 Looking for a formula(s) that will return the next date (higher than the starting date) from a row of dates, then the next date from that one. Excel Formula: Count cells where value is date. (-2,2 and 1). In order to show how ABS is array-friendly function let's do a simple test: Select G1:G5, digit =ABS(F1:F5) in the formula bar and press Ctrl+Shift+Enter. It's like someone write Abs(F1:F5)(1), Abs(F1:F5)(2), etc.

I'm looking for a formula to run a COUNTIF (or similar) on a range of cells, and where the contained value is a date, to increment the counter - essentially something like:

What I haven't been able to find is a logical test for the if_date() part of the question. Is there a way to test a cell to check whether its content is a date?

jvc26jvc26
3,7104 gold badges30 silver badges65 bronze badges

9 Answers

This is difficult with worksheet functions because dates in excel are simply formatted numbers - only CELL function lets you investigate the format of a cell (and you can't apply that to a range, so a helper column would be required).......or, if you only have dates and blanks.....or dates and text then it would be sufficient to use COUNT function, i.e.

=COUNT(range)

That counts numbers so it won't be adequate if you want to distinguish dates from numbers. If you do then the number range could be utilised, e.g. if you have numbers in a range and dates but the numbers will all be lower than 10,000 and the dates will all be relatively recent then you could use this version to exclude the numbers

=COUNTIF(range,'>10000')

barry houdinibarry houdini
42.3k6 gold badges49 silver badges70 bronze badges

Here's one approach. Using a combination of the answers above do the following:

  1. Convert cell to text using a predefined format
  2. Try using DATEVALUE to convert it back to a date
  3. Exclude any cells where DATEVALUE returns an error

As a formula, just use the example below with <> replaced with your range reference.

You must enter this as an array formula with CTRL + SHIFT + ENTER.

Excel how to count cells with dates in them
user1600453user1600453

Here's my solution. If your cells will contain only dates or blanks, just compare it to another date. If the cell can be converted to date, it will be counted.

Caution, cells with numbers will be counted.

Paul StephensPaul Stephens

This assumes that the column of potential date values is in column A. You could do something like this in an adjacent column:

Make a nested formula that converts the 'date' to its numeric value if it's valid, or an error value to zero if it's not.
Then it converts the valid numeric values to 1's and leaves the zeroes as they are.
Then sum the new column to get the total number of valid dates.

=IF(IFERROR(DATEVALUE(A1),0)>0,1,0)

glthornberryglthornberry

To count numbers or dates that meet a single test (such as equal to, greater than, less than, greater than or equal to, or less than or equal to), use the COUNTIF function. In Excel 2007 and later, to count numbers or dates that fall within a range (such as greater than 9000 and at the same time less than 22500), you can use the COUNTIFS function. If you are using Excel 2003 or earlier, you can use the SUMPRODUCT function to count the numbers that fall within a range (COUNTIFS was introduced in Excel 2007).

please see more

user1193035

There is no interactive solution in Excel because some functions are not vector-friendly, like CELL, above quoted. For example, it's possible counting all the numbers whose absolute value is less than 3, because ABS is accepted inside a formula array.

So I've used the following array formula (Ctrl+Shift+Enter after edit with no curly brackets)

If Column F has

It counts 3! (-2,2 and 1). In order to show how ABS is array-friendly function let's do a simple test: Select G1:G5, digit =ABS(F1:F5) in the formula bar and press Ctrl+Shift+Enter. It's like someone write Abs(F1:F5)(1), Abs(F1:F5)(2), etc.

Now I put some mixed data, including 2 date values.

In this case, CELL fails and return 1

It happens because CELL return the format of first cell of the range. (D4 is a m-d-y format)

Countif Date Range Month

So the only thing left is programming! A UDF(User defined Function) for formula array must return a variant array:

Now is easy (the constant VbDate is 7):

It shows 2. That technique can be used for any shape of cells. I've tested vertical, horizontal and rectangular shapes, since you fill usingfor each order inside the function.

Paulo BuchsbaumPaulo Buchsbaum

A bit long winded but it works for me: try this::

first part of if will allow cell to be blank or if there is something in the cell it tries to convert to a year, if there is an error or there is something other than a date result = 1, do the same for each cell and sum the result

tinlyx
11.5k20 gold badges61 silver badges121 bronze badges
Bill HanniganBill Hannigan

Here is how I was able to trick Excel to count expired certifications in a list. I didn't have a set date, or date range, just current date. 'TODAY()' doesn't work in these for Excel 2013. It sees it as text or condition, not the date value. So these previous didn't work for me.So the word problem/scenario: How many people are expired in this list?

Use: =IFERROR(D5-TODAY(),0)Where D5 is the date to be interrogated.

Then use: =IF(J5>=1,1,0)Where J5 is the cell where the first equation is producing either a positive or negative number. This set, I have hidden on the side of the visible sheet, then I just sum the total for the number of unexpired members.

FireflyFirefly

Total number of cells in a range minus the blank cells of the same range.

=(115 - (COUNTBLANK(C2:C116)))

This counts everything in the range so, maybe not what you're looking for.

Luke CogburnLuke Cogburn

Not the answer you're looking for? Browse other questions tagged excelexcel-formula or ask your own question.

How to count the number of cells with data in Excel?

Supposing you have a range of data, and some cells in this range are without any data, but you just need to count the number of cells with data, do you have any good methods to count the nonblank cells only instead of counting one by one manually in Excel?

Excel Count Cells With Dates

Compare Ranges utility (can compare two ranges, and select and color the same values or different values.)

Recommended Excel Productivity Tools

Bring tabbed editing and browsing to Office (include Excel), much more powerful than the browser's tabs. Free Download...

More than300 powerful advanced features for Excel, designed for1500 work scenarios, save70% time for you. Free Download...

Count cells contain data with formula

Amazing! Using Efficient Tabs in Excel Like Chrome, Firefox and Safari!
Save 50% of your time, and reduce thousands of mouse clicks for you every day!

Here I can tell you a simple formula to count the cells containing data in Excel.

Select a blank cell which you will output the counting result, and enter this formula =COUNTA(A1:D7), press Enter key to get the answer. See screenshot:

Tip: in the formula, A1:D7 is the data range you use.

Never need to worry about long long formulas in Excel anymore! Kutools for Excel's Auto Text can add all formulas to a group
as auto text, and liberate your brain! Know About Auto TextGet Free Trial

Excel How To Count Cells With Dates In Them

Count cells contain data with Kutools for Excel

If you want to count the cells with data, but also identify and select these cells, you can use Kutools for Excel’s Select Nonblank Cells utility to quickly count the cells which contain data and select them.

with more than 120 handy Excel functions, enhance your working efficiency and save your working time.

After free installing Kutools for Excel, please do as below:

1. Select the data range you use, and then click Kutools > Select > Select Nonblank Cells. See screenshot:

2. Then a dialog pops out to tell you the number of nonblank cells, and at the same time, all the nonblank cells are selected. See screenshot:

3. You can close OK to close the dialog, and the nonblank cells will be kept selected.

Relative Articles:

Recommended Productivity Tools for Excel

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than300 powerful advanced features, designed for1500 work scenarios, increasing productivity by70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds,
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by50%, and reduces hundreds of mouse clicks for you every day!
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
   Coments are closed