+ Reply to Thread
Results 1 to 9 of 9

Time If

  1. #1
    Registered User
    Join Date
    03-08-2007
    Posts
    23

    Time If

    Hi

    How can i do that

    If Time In cell A1>= 10.00 am then write " Open " in cell A2

    If Time In cell A1>= 3.00 PM then Write " closed " in cell A2

    Thank's
    Last edited by VBA Noob; 01-04-2009 at 03:27 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    One Way:

    =LOOKUP(HOUR(N(A1)),{0,10,15},{"","Open","Closed"})

  3. #3
    Registered User
    Join Date
    03-08-2007
    Posts
    23
    Thank's soooo much

  4. #4
    Registered User
    Join Date
    03-08-2007
    Posts
    23
    One More Question

    If also today saturday or sunday then write " closed " in cell A2

    Thank's

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Not sure if you actually want today's date or a date in A1 but you could adapt DonkeyOte's formula like this

    =IF(WEEKDAY(TODAY(),2)<6,LOOKUP(HOUR(A1),{0,10,15},{"","Open","Closed"}),"Closed")

  6. #6
    Registered User
    Join Date
    03-08-2007
    Posts
    23
    Quote Originally Posted by daddylonglegs View Post
    Not sure if you actually want today's date or a date in A1 but you could adapt DonkeyOte's formula like this

    =IF(WEEKDAY(TODAY(),2)<6,LOOKUP(HOUR(A1),{0,10,15},{"","Open","Closed"}),"Closed")
    I Think Not ok

    Thank's for your help
    Last edited by HOSAMNOOR; 01-04-2009 at 05:34 PM.

  7. #7
    Registered User
    Join Date
    03-08-2007
    Posts
    23
    Quote Originally Posted by daddylonglegs View Post
    Not sure if you actually want today's date or a date in A1 but you could adapt DonkeyOte's formula like this

    =IF(WEEKDAY(TODAY(),2)<6,LOOKUP(HOUR(A1),{0,10,15},{"","Open","Closed"}),"Closed")
    would you please tell me how can i change the weekend on the code , for example if i want to change the " close " to be on teusday and friday ?

    or if it on friday and saturday

    how can i control that on the code

    thanks

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    This formula will alway give "Closed" if today is Tuesday or Friday

    =IF(OR(WEEKDAY(TODAY())={3,6}),"Closed",LOOKUP(HOUR(A1),{0,10,15},{"","Open","Closed"}))

    In this part {3,6}

    3 represents Tuesday and 6 Friday (1=Sunday throught to 7 = Saturday) so you can change that part to whichever numbers you want

  9. #9
    Registered User
    Join Date
    03-08-2007
    Posts
    23
    Big Thank's

+ 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