Dates and SMALL Formula

Fin Fang Foom

Well-known Member
Joined
Mar 20, 2005
Messages
598
Hi everyone,


I have dates like this in column A:

1060911
1060914
1060912
1060915
1060913
and so on...

I would like to get the smallest date and then the second and third smallest dates in column E.

It should look like this:

09/11/2006
09/12/2006
09/13/2006

I have this formula, it will get me the Min of the date.

=DATE(INT(MIN($A$2:$A$851/10000)),MID(MIN($A$2:$A$851),4,2),RIGHT(MIN($A$2:$A$851),2))

I tried to incorporate the small function into the formula to get the smallest dates but it does not work.

=DATE(INT(SMALL($A$2:$A$851,ROW(A1))/10000),MID(SMALL(Sheet2!$A$2:$A$851,ROW(A1)),4,2),RIGHT(SMALL($A$2:$A$851,ROW(A1)),2))


If possible I would like a all in one formula.
Book3
ABCDEF
1DATEMIN
210609129/11/2006#NUM!
31060912#NUM!
41060912#NUM!
51060914#NUM!
61060911#NUM!
71060912#NUM!
81060914
91060911
101060911
111060911
121060913
131060911
141060911
151060911
161060911
171060915
181060911
Sheet1
 
Try...

C2, copied down:

=MIN(IF(A$2:A$18<>"",IF(ISNUMBER(MATCH(DATE(2000+(100*LEFT(A$2:A$18)-100)+MID(A$2:A$18,2,2),MID(A$2:A$18,4,2),MID(A$2:A$18,6,2)),C$1:C1,0)),"",DATE(2000+(100*LEFT(A$2:A$18)-100)+MID(A$2:A$18,2,2),MID(A$2:A$18,4,2),MID(A$2:A$18,6,2)))))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!


Thank You again It works perfect.
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try...

=SUM(IF(A$2:A$18<>"",IF(DATE(2000+(100*LEFT(A$2:A$18)-100)+MID(A$2:A$18,2,2),MID(A$2:A$18,4,2),MID(A$2:A$18,6,2))=C2,B$2:B$18)))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
Upvote 0
Try...

=SUM(IF(A$2:A$18<>"",IF(DATE(2000+(100*LEFT(A$2:A$18)-100)+MID(A$2:A$18,2,2),MID(A$2:A$18,4,2),MID(A$2:A$18,6,2))=C2,B$2:B$18)))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!


Thank You!
 
Upvote 0
Hi Domenic,

I would like to convert my dates as text dates.


=TEXT(MIN(IF(A$2:A$545<>"",IF(ISNUMBER(MATCH(DATE(2000+(100*LEFT(A$2:A$545)-100)+MID(A$2:A$545,2,2),MID(A$2:A$545,4,2),MID(A$2:A$545,6,2)),J$1:J5,0)),"",DATE(2000+(100*LEFT(A$2:A$545)-100)+MID(A$2:A$545,2,2),MID(A$2:A$545,4,2),MID(A$2:A$545,6,2))))),"m-dd-yyyy")


The formula above is not working is there a way we can have it to return as text dates?
 
Upvote 0
I just tried the formula and it seems to work fine. What happens when you try it?
 
Upvote 0
I just tried the formula and it seems to work fine. What happens when you try it?


Thank You for replying Domenic.

The formula you provided works perfectly. But when I tried to modified it to have it as in text dates it repeats the first date when I fill down the formula.


Example:
Foundry Weekly DownTime.xls
ABCD
1DATE
210609269/25/20069-25-2006
310609279/26/20069-25-2006
410609279/27/20069-25-2006
510609279/28/20069-25-2006
610609259/29/20069-25-2006
710609251/0/19009-25-2006
81060925
91060925
101060925
111060925
121060926
131060926
141060926
151060926
161060926
171060926
181060926
191060926
201060926
211060926
221060926
Downtime Data
 
Upvote 0
It seems to work if you change the lookup range C$1:C1 to B$1:B1 (I think because now the items above each entry are text...it no longer works as expected).

Your formula now:

=TEXT(MIN(IF(A$2:A$545<>"",IF(ISNUMBER(MATCH(DATE(2000+(100*LEFT(A$2:A$545)-100)+MID(A$2:A$545,2,2),MID(A$2:A$545,4,2),MID(A$2:A$545,6,2)),C$1:C1,0)),"",DATE(2000+(100*LEFT(A$2:A$545)-100)+MID(A$2:A$545,2,2),MID(A$2:A$545,4,2),MID(A$2:A$545,6,2))))),"m-dd-yyyy")

The bold part is what to change:

=TEXT(MIN(IF(A$2:A$545<>"",IF(ISNUMBER(MATCH(DATE(2000+(100*LEFT(A$2:A$545)-100)+MID(A$2:A$545,2,2),MID(A$2:A$545,4,2),MID(A$2:A$545,6,2)),B$1:B1,0)),"",DATE(2000+(100*LEFT(A$2:A$545)-100)+MID(A$2:A$545,2,2),MID(A$2:A$545,4,2),MID(A$2:A$545,6,2))))),"MM-DD-YYYY")
 
Upvote 0
Sorry....that was stupid of me....In my sample I still had a column B with the original formula so I was referencing it and it was working....

Anyways...you need to convert your text dates to numerical as you go...so just add a +0 to the end of the same lookup array, like so.

=TEXT(MIN(IF(A$2:A$20<>"",IF(ISNUMBER(MATCH(DATE(2000+(100*LEFT(A$2:A$20)-100)+MID(A$2:A$20,2,2),MID(A$2:A$20,4,2),MID(A$2:A$20,6,2)),B$1:B1+0,0)),"",DATE(2000+(100*LEFT(A$2:A$20)-100)+MID(A$2:A$20,2,2),MID(A$2:A$20,4,2),MID(A$2:A$20,6,2))))),"MM-DD-YYYY")
 
Upvote 0

Forum statistics

Threads
1,225,477
Messages
6,185,224
Members
453,283
Latest member
Shortm88

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