MINimum Function and blank/empty cells

ArPharazon

Board Regular
Joined
May 3, 2004
Messages
51
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
I have seen references here to formulas like this =MIN(IF(A1:A3="",0,A1:A3))

What I'm doing is this =MIN(G2,I2)

I want the minimum value (earliest date/time) from one cell or the other which are in date/time (mm/dd/yyyy hh:mm) format.

The only issue is, it represents 2 blank cells as 01/00/1900 00:00 instead of a blank cell.

Anything I can do with the formula?

 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Because MIN() returns 0 with all blanks, and since your formula cell is formatted as date, that results in 1/0/1900.

You could wrap it like this:

=IF(MIN(G2,I2),MIN(G2,I2),"")
 
Upvote 0
Because MIN() returns 0 with all blanks, and since your formula cell is formatted as date, that results in 1/0/1900.

You could wrap it like this:

=IF(MIN(G2,I2),MIN(G2,I2),"")

Thanks. That does work, though I have to format the result as mm/dd/yyyy hh:mm,
whereas the simpler formula did that automatically.
 
Upvote 0
Ah, well as long as it works right? I don't know if there is another way that it might carry over the formatting.
 
Upvote 0
Ah, well as long as it works right? I don't know if there is another way that it might carry over the formatting.

There is. Someone here at work showed me a more complicated formula.

=IF(COUNTBLANK([@[Finish Date]])+COUNTBLANK([@[Completion Date]])=2,"",MIN(G2,I2))

My hope is there won't be any unfinished/uncompleted Work Orders on this particular Task any more, but I'm not sure that will ever happen.
 
Upvote 0
Glad you got a working solution then. Curious though how one works one way and the other works different. They both effectively return a "" or MIN(G2,I2), so why one adopts the formatting and the other doesn't... it is beyond me.
 
Upvote 0
Glad you got a working solution then. Curious though how one works one way and the other works different. They both effectively return a "" or MIN(G2,I2), so why one adopts the formatting and the other doesn't... it is beyond me.

I'd just chalk it up to being an "Excel thing". Cell formatting can be a real PITA most of the time. I'm surprised it automatically formats that data as date/time at all.

It's nice to know a have a couple options.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top