Closed Thread
Results 1 to 8 of 8

how to create nested if function for military time

  1. #1
    Registered User
    Join Date
    08-31-2013
    Location
    brampton, canada
    MS-Off Ver
    Excel 2010
    Posts
    23

    Question how to create nested if function for military time

    cell A1 has military time, 04:25:00
    how to create a nested if function if the value of time in A1 is between 07:00:00 and 15:00:00, then B1 should display "a"; if the value of time in A1 is between 15:00:00 and 23:00:00, then B1 should display "b";if the value of time in A1 is between 23:00:00 and 07:00:00, then B1 should display "c";

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: how to create nested if function for military time

    A B C D E
    4:25:00 c 0:00:00 c
    7:00:00 a
    15:00:01 b
    23:00:00 c


    B2=VLookup($A2;$D$2:$E$5;2;1)
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: how to create nested if function for military time

    If A1 has time use

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: how to create nested if function for military time

    Your intervals are not well defined. They overlap.

    between 07:00:00 and 15:00:00, then B1 should display "a"
    between 15:00:00 and 23:00:00, then B1 should display "b"
    between 23:00:00 and 07:00:00, then B1 should display "c"

    If A1 = 15:00 what result do you expect? "A" or "B"?

    If A1 = 23:00 what result do you expect? "B" or "C"?

    If A1 = 7:00 what result do you expect? "C" or "A"?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    08-31-2013
    Location
    brampton, canada
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: how to create nested if function for military time

    Appreciate your help. Thanks

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: how to create nested if function for military time

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  7. #7
    Registered User
    Join Date
    09-19-2022
    Location
    IRAN
    MS-Off Ver
    2022
    Posts
    1

    Re: how to create nested if function for military time

    Hi,i have comparison 3 column and if any cell was the same in column 1&2, than lookup cell of column 3
    i mean's IF(F:F=Sheet2!D:D,VLOOKUP(Sheet2!C:C,Sheet2!C1:D3963,1,TRUE))
    but not working can you hellp me?

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: how to create nested if function for military time

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Nested If Function, using 'AND' and 'OR' at the same time
    By jonmel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2013, 09:55 AM
  2. Simple way to convert military time to standard where military has no colon
    By salvator in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2011, 10:27 AM
  3. [SOLVED] Show timesheet time in and out in regular time versus military tim
    By John in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-11-2005, 01:20 AM
  4. Concatenate Function/converting military time to AM/PM
    By brianwakin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-01-2005, 03:05 PM
  5. [SOLVED] military time function
    By Beth in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2005, 01:06 AM

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