+ Reply to Thread
Results 1 to 4 of 4

and formula with 4 different scenarios

  1. #1
    Registered User
    Join Date
    07-28-2009
    Location
    Chicago, Il
    MS-Off Ver
    Excel 2007
    Posts
    67

    and formula with 4 different scenarios

    Hello,
    i am having difficulty with trying to write a specific formula with ANDs can you tell me if this can be done
    i have a now() cell in A2 and need in D2 to say that
    if time is between 9am and 12:59pm the show "10:00 AM"
    or if time is between 1pm and 4:59pm show "2pM
    or if time is between 5pm and 8:59pm show 6pm
    or if time is between 9pm to 11:59pm show 10pm

    can this be done in one cell of do i need 4 different cells

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: and formula with 4 different scenarios

    =LOOKUP(A2,{0.375,0.5416666667,0.7083333333,0.875},{0.416666667,0.583333333,0.75,0.916666667}) cell formated time hh:mm . is a way of doing it
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: and formula with 4 different scenarios

    Or, for the decimal-impaired,

    =LOOKUP(MOD(A2, 1), {9,13,17,21}/24, {10,14,18,22}/24)
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: and formula with 4 different scenarios

    lol, i knew there must be a simpler way

+ 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