+ Reply to Thread
Results 1 to 15 of 15

min date with if condition

  1. #1
    Registered User
    Join Date
    01-18-2018
    Location
    Brighton
    MS-Off Ver
    MS office 10
    Posts
    4

    Lightbulb min date with if condition

    Hi guys I'm trying to get the min date in column C if column S has a certain criteria in F.
    So now I'm using as an array the below formula:

    =MIN(IF('Overall Data'!$S:$S=Help!$F$2,'Overall Data'!$C$1:$C$11116))

    Unfortunately it gives me back 00/01/1900 despite I don't have any 0 in the date column, anyone any idea why this is happening and how to solve it?

    Many thanks as usual!!

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: min date with if condition

    Hello and welcome to the forum.

    Rather than showing us a non-working formula, I recommend creating a small representative sample sheet along with the desired results (manually entered) and uploading that here.

    To attach an Excel workbook, click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: min date with if condition

    It will probably be a result of the fact that the formula does not refer tot he same range. If you have a blank cell in the date column that corresponds to the value in F2 in the other column, it will return a zero. Are the columns of REALLY of unequal length????
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: min date with if condition

    Hi all- @Valeria88, although your formula returns a single result, it processes arrays to arrive at that result. Therefore, it is a single-cell ARRAY FORMULA. Such formulas return incorrect results UNLESS you press CTRL+SHIFT+ENTER after pasting or editing in the Formula Bar. This tells Excel to check for arrays during calculation. If done properly, {} curly braces will appear and enclose your formula, signalling successful array entry.
    NOTES:
    1) NO, you can't just type the braces in, as that causes Excel to treat the entry as TEXT rather than a formula.
    2) To copy a ARRAY FORMULA to other cells, either "drag" it, or select a SEPARATE paste area that does not include the copied cell.

    Guidelines-and-examples-of-array-formulas
    Last edited by leelnich; 01-18-2018 at 01:26 PM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: min date with if condition

    Oh. Thanks leelnich. i forgot to add my canned "array formula" response.

  6. #6
    Registered User
    Join Date
    01-18-2018
    Location
    Brighton
    MS-Off Ver
    MS office 10
    Posts
    4

    Re: min date with if condition

    So thank you all for your replies,

    so @Glenn yes all the columns have same range length and yes @leelnich I'm processing the array CTRL+SHIFT+ENTER. still is giving me 0. Just to underline that dates are formatted as dates. Any other idea?


    thanks,

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: min date with if condition

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: min date with if condition

    MIN may return zero in this case, either if nothing matches or the dates are text formatted. For debugging what result do you get with this formula?

    =SUMPRODUCT(('Overall Data'!$S:$S=Help!$F$2)+0,'Overall Data'!$C$:$C)
    Audere est facere

  9. #9
    Registered User
    Join Date
    01-18-2018
    Location
    Brighton
    MS-Off Ver
    MS office 10
    Posts
    4

    Re: min date with if condition

    Hello daddylonglegs

    thanks for this, unfortunately even yours keeps giving me back 0.
    I'm attaching a simplify file, hope anyone can help.

    thanks,
    Attached Files Attached Files

  10. #10
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,909

    Re: min date with if condition

    Edit:

    =MIN(IF('overall data'!$S:$S=help!$F$2&" ",'overall data'!$C:$C))

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: min date with if condition

    The root cause of your problem is that the formula in S returns "6.17 " formatted as text, with a training space. it's probably better to get rid of the trailing space, rather than taking it into account. So, modify the formula in S to:

    =IFERROR(TRIM(MID(E2,FIND(".17 ",E2)-1,5))+0,0)

    and then use the array formula:

    =MIN(IF('overall data'!$S$2:$S$12000=help!$F$2,'overall data'!$C$2:$C$12000))

    to return the desired result. Alternatively, modify column S and use this ordinary formula:

    =AGGREGATE(15,6,'overall data'!$C$2:$C$12000/('overall data'!$S$2:$S$12000=help!$F$2),1)

  12. #12
    Registered User
    Join Date
    01-18-2018
    Location
    Brighton
    MS-Off Ver
    MS office 10
    Posts
    4

    Re: min date with if condition

    Hello Glenn,

    lovely! thanks,

    Valeria

  13. #13
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: min date with if condition

    if you are able to use PowerQuery
    Attached Files Attached Files

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: min date with if condition

    You're welcome.

  15. #15
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: min date with if condition

    Hi all. You could also skip column S altogether. In help!H2:
    Please Login or Register  to view this content.
    ...and in H3:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 05-20-2017, 10:29 AM
  2. Date entry control-condition date in cell J>date in cell H
    By erkamu in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-01-2014, 07:04 AM
  3. Replies: 3
    Last Post: 02-02-2014, 04:26 AM
  4. Excel 2007 : Date as a condition
    By nna in forum Excel General
    Replies: 11
    Last Post: 11-18-2011, 12:07 AM
  5. use date in row as condition
    By flornkex in forum Excel General
    Replies: 4
    Last Post: 10-14-2009, 11:47 AM
  6. multi condition format? lookup and date condition valid for.
    By D_Rennie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-13-2009, 11:37 AM
  7. Calculate a date or key a date on condition
    By Tolo in forum Excel General
    Replies: 2
    Last Post: 06-13-2006, 11:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1