+ Reply to Thread
Results 1 to 12 of 12

Help please if possible with nested IF statement I think

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    Derbyshire, UK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Help please if possible with nested IF statement I think

    Hi All

    I would like to produce a forumla to do the following:

    If the date in Cell A2 is after today AND there is nothing in Cell B2 then add the words 'Out of Time' to Cell C2 and turn all the text in the line red. (tho I would settle for just the 'Out of Time' being red if whole line not possible - I spent ages playing with conditional formatting yesterday)

    If the date in Cell A2 is after today AND the date in Cell B2 is before the date in Cell A2 then do nothing

    If the date in Cell A2 is after today AND the date in Cell B2 is after the date in Cell A2 then add the words 'Out of Time' to Cell C2 and turn the line back to black text

    If the date in Cell A2 is before today then do nothing

    I think I need a nested IF forumla and thought I had done it yesterday, but I got in a tizz.

    Any suggestions appreacited - thanks for taking the time
    Last edited by AnneFr; 11-02-2012 at 09:14 AM.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Help please if possible with nested IF statement I think

    Try.

    =IF(AND(A2>TODAY(),B2<A2),"",IF(AND(OR(A2>TODAY(),B2>A2),OR(A2>TODAY(),B2="")),"Out of Time",""))

    Use the same conditions in conditional format rules for filling with colour the cell.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    10-26-2012
    Location
    Derbyshire, UK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Help please if possible with nested IF statement I think

    Hi Fotis

    Thanks for the very swift reply.

    It didn't behave in quite the way i expected... so I changed all the " " to give different answers, to try to work out where the error was, but i am still floundering!

    =IF(AND(O4>TODAY(),P4<O4),"Option 1",IF(AND(OR(O4>TODAY(),P4>O4),OR(O4>TODAY(),P4="Option 2")),"Option 3","Option 4"))

    If o4 is after today and p4 is blank = Otption 1 (blank) - correct

    If o4 is after today and p4 is before o4 = Option 1 (blank) - correct

    If o4 is before today and p4 is before o4 = Option 4 (blank) - correct

    If o4 is before today and p4 is blank = Option 4 (blank) - should be Option 3 (Out of Time)

    If o4 is before today and p4 is after o4 = Option 4 (blank) - should be Option 3 (out of Time)

    No matter how I re-arrange things I can't seem to get quite the answers I want in all of the places at all of the time and I can't ever get Option 2 (but i don't think that matters)

    Thanks again

    Kind regards

    Anne

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Help please if possible with nested IF statement I think

    Hi Anne.

    In your example that you gave to us in first post, formula works fine.

    So for not trying without reason, pls upload a small sample workbook and manually type the expected results.

  5. #5
    Registered User
    Join Date
    10-26-2012
    Location
    Derbyshire, UK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Help please if possible with nested IF statement I think

    Thanks Fotis

    Its attached with test data (I hope) and what I am getting and what I would expect to get - thanks again
    Attached Files Attached Files

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Help please if possible with nested IF statement I think

    Why Q8 & Q9 must be "Out of Time"? By which condition?

    Why Q11, must be nothing? What you mean by"2nd date is error"? The condition that you get a "Out of Time" is this.

    .....P11>O11);OR(O11>TODAY();P11="")

  7. #7
    Registered User
    Join Date
    10-26-2012
    Location
    Derbyshire, UK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Help please if possible with nested IF statement I think

    Hi Fotis

    Sorry if I am confusing - I hope this makes sense

    Q8 is out of time beacuse date P8 is after o8, so therefore the response was later than required

    q9 is out of time beacuse a response (ie date in p9) has not been entered

    q11 should be blank as the date entered in p11 has not happened yet, so it must be an error date (beacuse dates in p must only be today or before)

    Hope this makes things clearer and thank you so much for helping out

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Help please if possible with nested IF statement I think

    Yes i must say that i am comfuse...

    This formula works for Q8:Q12, but not for Q7. Which is the correct criterion for Q7?

    =IF(AND(O8>TODAY(),P8<O8),"",IF(AND(O8>TODAY(),P8>O8),"","Out of Time"))

  9. #9
    Registered User
    Join Date
    10-26-2012
    Location
    Derbyshire, UK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Help please if possible with nested IF statement I think

    So sorry for confusing you!

    Yup it works for everything except line 7.

    Q7 should be blank as the date in p7 is before the date in o7 and therefore a response was received within the time limit.

    Thanks

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Help please if possible with nested IF statement I think

    This one, gives the correct results.

    =IF(AND(P7<O7,P7>0),"",IF(AND(O7>TODAY(),P7<O7),"",IF(AND(O7>TODAY(),P7>O7),"","Out of Time")))

  11. #11
    Registered User
    Join Date
    10-26-2012
    Location
    Derbyshire, UK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Help please if possible with nested IF statement I think

    Thanks very much for all your trouble Fotis, i will mark post as solved.

  12. #12
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Help please if possible with nested IF statement I think

    You are welcome!

    Thanks for the reb*

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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