Home » excel » Using the Mode function with dates (decimal data) in Excel

Using the Mode function with dates (decimal data) in Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a column of dates in Excel, and there will always be only two dates in the column. I want a formula to return the date that exists most (so if 1/23/13 occurs 24 times and 1/24/13 occurs 72 times, I want the formula to return 1/24/13).

I used the MODE formula across the range, and this worked for a couple days in a row, but today it did not work. Upon further review, I realized the dates are really viewed by Excel as decimal numbers, and I imagine this is the problem.

I could get to what I need by inserting a new column and filling it with =TRUNC(cell) for all cells in the range, and then applying the MODE formula to the new column, but I’m hoping there might be a way to do it without introducing a new column or formulas. Is it possible to do something like =MODE(TRUNC(range))? That specific formula didn’t work, but I’m hoping something similar will.

How to&Answers:

Yes, your suggested formula should work……but it’s an “array formula” which means that you need to enter it with a specific key combination.

Paste the formula in the cell then press F2 key to select formula and then hold down CTRL + SHIFT keys and press ENTER. If done correctly that will place curly braces like { and } around the formula in the formula bar.

If you have any blanks in the range then the result may be skewed with

=MODE(TRUNC(range))

so you can change that to

=MODE(IF(range<>"",TRUNC(range)))