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
124

Comments

  • shaz77_2
    shaz77_2 Posts: 1,881 Forumite
    I will give it some thought. Have you tried the rest of the code?

    Weekends are still a problem, if I input Friday 14/09/12 at 14:00 as the arrival time and Monday 17/09/12 at 14:00 as the despatch time it returns a failed when this should be a pass.
  • I didn't realise that should be a pass, I assumed if it was Friday then it would need to be Saturday to pass. I can build it in.

    I will look at it again tonight, quite a few little quirks that make this complex!
    Thinking critically since 1996....
  • shaz77_2
    shaz77_2 Posts: 1,881 Forumite
    I didn't realise that should be a pass, I assumed if it was Friday then it would need to be Saturday to pass. I can build it in.

    I will look at it again tonight, quite a few little quirks that make this complex!

    Thanks for that, everytime I think I have it solved another problem arises but basically anything that arrives after 13:00 on a Friday should be a pass if despatched on the following Monday.
  • Yep, that is not too complicated (just something that I had not picked up from everyone elses' code in the thread).
    Thinking critically since 1996....
  • Stompa
    Stompa Posts: 8,375 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    shaz77 wrote: »
    Thanks for that, everytime I think I have it solved another problem arises but basically anything that arrives after 13:00 on a Friday should be a pass if despatched on the following Monday.
    I'm still at a loss to know what's wrong with my earlier simple solution, it does precisely that! This really is a trivial problem, that should only take a few minutes to code.
    Stompa
  • Stompa wrote: »
    I'm still at a loss to know what's wrong with my earlier simple solution, it does precisely that! This really is a trivial problem, that should only take a few minutes to code.

    I tried this solution, appears to do the trick.

    Not sure why the OP missed it first time around, it's very elegant compared to mine (which only partially works). :T
    Thinking critically since 1996....
  • Stompa
    Stompa Posts: 8,375 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Not sure why the OP missed it first time around, it's very elegant compared to mine (which only partially works). :T
    I don't know about elegant, but given that Excel has functions to manipulate dates and times it seems to make sense to use them!
    Stompa
  • shaz77_2
    shaz77_2 Posts: 1,881 Forumite
    Just testing the following code out at a different PC (this has Excel 2010 on it) and the following code brings up the #NAME? error message.

    =IF(dayout<1+WORKDAY(dayin,1-(HOUR(dayin)<13)),"Pass","Fail")
  • Stompa
    Stompa Posts: 8,375 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    shaz77 wrote: »
    Just testing the following code out at a different PC (this has Excel 2010 on it) and the following code brings up the #NAME? error message.

    =IF(dayout<1+WORKDAY(dayin,1-(HOUR(dayin)<13)),"Pass","Fail")
    Yes, you need to substitute 'dayin' and 'dayout' with the actual cells containing your dates, for example:

    =IF(B2<1+WORKDAY(A2,1-(HOUR(A2)<13)),"Pass","Fail")
    Stompa
  • Stompa wrote: »
    I don't know about elegant, but given that Excel has functions to manipulate dates and times it seems to make sense to use them!

    Yep, very clever :D
    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.