min function return earliest date from 2 other functions

sarah1991

New Member
Joined
Oct 20, 2015
Messages
26
Hi I have a function called getdates and getdates2 basicly they are you same function but folder Dir is different
I want to get earliest date using min function
Like =min (getdates, getdates2) will work fine if there is text file with specific date if no date found then it will return 0
When I check each function individualy one return 0 and the other a date
So how can I use min function and ignore the function that return 0 ?

Excel 2010 win 7
 
C2 contain text "Start"
D2 contain text "End"
B4 contain Date 01-Sep-2015
as shown below

it works fine if both folders contain the required text file if not then return 0

5euakh.jpg
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You exhibit shows the word Start in C2 and the word End in D2 while B4 displays apparently a date. What is the result of FSDates(B4,C2)? Select the FSDates(B4,C2) bit on the formula bar, hit F9, copy what you see, and paste it here.
 
Upvote 0
You exhibit shows the word Start in C2 and the word End in D2 while B4 displays apparently a date. What is the result of FSDates(B4,C2)? Select the FSDates(B4,C2) bit on the formula bar, hit F9, copy what you see, and paste it here.
it return "02-Sep-2015 06:01:10 AM"
because there is text file in each folder with the date required it works fine for 1-sep-2015
but 2-sep-2015 there is not text file contain the date required in log 2 folder that's why FSGetDate(B4,C2) return date but FSGetDate2(B4,C2) return 0
here as requested "0"
note else line" no date match user ....." has been removed if it was here the return would be that text
 
Upvote 0
it return "02-Sep-2015 06:01:10 AM"
because there is text file in each folder with the date required it works fine for 1-sep-2015
but 2-sep-2015 there is not text file contain the date required in log 2 folder that's why FSGetDate(B4,C2) return date but FSGetDate2(B4,C2) return 0
here as requested "0"
note else line" no date match user ....." has been removed if it was here the return would be that text

We have thus an outcome pair which consists of:

02-Sep-2015 06:01:10 AM, 0

Apparently, you want to return 02-Sep-2015 06:01:10 AM, right?

If we have the following pair:

02-Sep-2015 06:01:10 AM, 02-Sep-2015 08:01:10 AM

you want to return 02-Sep-2015 08:01:10 AM, right?
 
Upvote 0
We have thus an outcome pair which consists of:

02-Sep-2015 06:01:10 AM, 0

Apparently, you want to return 02-Sep-2015 06:01:10 AM, right?

If we have the following pair:

02-Sep-2015 06:01:10 AM, 02-Sep-2015 08:01:10 AM

you want to return 02-Sep-2015 08:01:10 AM, right?
This pair 02-Sep-2015 06:01:10 AM, 0 should return the date and ignore the 0
This pair 02-Sep-2015 06:01:10 AM, 02-Sep-2015 08:01:10 AM
With min function return should be 02-Sep-2015 06:01:10 AM
Max function 02-Sep-2015 08:01:10 AM
 
Upvote 0
This pair 02-Sep-2015 06:01:10 AM, 0 should return the date and ignore the 0
This pair 02-Sep-2015 06:01:10 AM, 02-Sep-2015 08:01:10 AM
With min function return should be 02-Sep-2015 06:01:10 AM
Max function 02-Sep-2015 08:01:10 AM

The MIN question:

=IF(COUNT(1/FSGETDATES(B4,C2),1/FSGetDates2(B4,C2))=2,MIN(FSGETDATES(B4,C2),FSGetDates2(B4,C2)),MAX(FSGETDATES(B4,C2),FSGetDates2(B4,C2)))
 
Upvote 0
The MIN question:

=IF(COUNT(1/FSGETDATES(B4,C2),1/FSGetDates2(B4,C2))=2,MIN(FSGETDATES(B4,C2),FSGetDates2(B4,C2)),MAX(FSGETDATES(B4,C2),FSGetDates2(B4,C2)))

Works like charm thank you very much Mr. Aladin
But how can I apply above to all cells C4:until end of file?
Only B4 to B5 the rest should stay the same
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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