We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Excel 2007 Query

Options
135

Comments

  • rmg1
    rmg1 Posts: 3,159 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Apologies, I didn't realise you could do weekend despatches.
    Try this instead:-
    =IF(TEXT(A2,"dd/mm/yyyy")=TEXT(B2,"dd/mm/yyyy"),"Pass",IF(TEXT(A2,"dddd")="Friday",IF(AND(H OUR(A2)>=13,TEXT(B2,"dd/mm/yyyy")<=TEXT(A2+3,"dd/mm/yyyy")),"Pass","Fail"),IF(AND(HOUR(A2)>=13,TEXT(B2,"dd/mm/yyyy")=TEXT(A2+1,"dd/mm/yyyy")),"Pass","Fail")))
    
    :wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:

    Any posts are my opinion and only that. Please read at your own risk.
  • shaz77_2
    shaz77_2 Posts: 1,881 Forumite
    rmg1 wrote: »
    Apologies, I didn't realise you could do weekend despatches.
    Try this instead:-
    =IF(TEXT(A2,"dd/mm/yyyy")=TEXT(B2,"dd/mm/yyyy"),"Pass",IF(TEXT(A2,"dddd")="Friday",IF(AND(H OUR(A2)>=13,TEXT(B2,"dd/mm/yyyy")<=TEXT(A2+3,"dd/mm/yyyy")),"Pass","Fail"),IF(AND(HOUR(A2)>=13,TEXT(B2,"dd/mm/yyyy")=TEXT(A2+1,"dd/mm/yyyy")),"Pass","Fail")))
    

    The following error message is appearing "#NAME?".
  • shaz77_2
    shaz77_2 Posts: 1,881 Forumite
    Stompa wrote: »
    Does the one I gave previously not work for you? And, if not, in what circumstances does it fail?

    It works fine up until the part for weekends is added.
  • shaz77_2
    shaz77_2 Posts: 1,881 Forumite
    I'll have another go at trying to resolve this one - it's very tricky.
  • Stompa
    Stompa Posts: 8,375 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    shaz77 wrote: »
    It works fine up until the part for weekends is added.
    Unfortunately I have no idea what you mean by "up until the part for weekends is added", it should work as it stands without adding anything. If you could provide more detail I'm happy enough to take a look.
    Stompa
  • shaz77 wrote: »
    The following error message is appearing "#NAME?".

    If you look at the quote there is a space in one of the words "H OUR". If you take this out it should resolve the name issue.
    Thinking critically since 1996....
  • shaz77_2
    shaz77_2 Posts: 1,881 Forumite
    If you look at the quote there is a space in one of the words "H OUR". If you take this out it should resolve the name issue.

    That part of the problem is fixed, however if I put down the arrival date as 15/09/12 14:00 and the depatch date as 17/09/12 12:00 it returns a fail, however this should not be the case as the 15th was a Saturday.
  • somethingcorporate
    somethingcorporate Posts: 9,449 Forumite
    edited 18 September 2012 at 10:47AM
    Try this in C2:

    [FONT=Calibri, sans-serif]=IF(ROUNDDOWN(IF(WEEKDAY(A2)=7,IF(HOUR(A2)<13,A2,(A2)+2),IF(HOUR(A2)<13,A2,(A2)+1)),0)-ROUNDDOWN(B2,0)=0,"Pass","Fail")

    You may need to change the < to <= depending on how you treat the 13:00 deadline.

    This looks at whether the weekday in question was 7 (Friday) and adds 2 days to the required by date for comparison.

    The slight untidy thing about this formula is if you then dispatch it on a Sunday it would fail. I can tidy this up further if you need me to for peripheral logical like that. Just want to check the above works ok first.

    FYI the rounddown element of the formula takes out the time from the cells, since we don't care about this for when it is dispatched (only for when it arrives).
    [/FONT]
    Thinking critically since 1996....
  • shaz77_2
    shaz77_2 Posts: 1,881 Forumite
    Try this in C2:

    [FONT=Calibri, sans-serif]=IF(ROUNDDOWN(IF(WEEKDAY(A2)=7,IF(HOUR(A2)<13,A2,(A2)+2),IF(HOUR(A2)<13,A2,(A2)+1)),0)-ROUNDDOWN(B2,0)=0,"Pass","Fail")[/FONT]

    [FONT=Calibri, sans-serif]You may need to change the < to <= depending on how you treat the 13:00 deadline.[/FONT]

    [FONT=Calibri, sans-serif]This looks at whether the weekday in question was 7 (Friday) and adds 2 days to the required by date for comparison.[/FONT]

    [FONT=Calibri, sans-serif]The slight untidy thing about this formula is if you then dispatch it on a Sunday it would fail. I can tidy this up further if you need me to for peripheral logical like that. Just want to check the above works ok first.[/FONT]

    [FONT=Calibri, sans-serif]FYI the rounddown element of the formula takes out the time from the cells, since we don't care about this for when it is dispatched (only for when it arrives).[/FONT]

    What would be the solution to despatching on a Sunday as this would need to be a pass in ther rare event of this actually happening.
  • shaz77 wrote: »
    What would be the solution to despatching on a Sunday as this would need to be a pass in ther rare event of this actually happening.

    I will give it some thought. Have you tried the rest of the code?
    Thinking critically since 1996....
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.8K Work, Benefits & Business
  • 598.7K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 257.1K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.