+ Reply to Thread
Results 1 to 12 of 12

how to get the specific time group for lookup a cell input?

  1. #1
    Registered User
    Join Date
    02-15-2016
    Location
    hongkong
    MS-Off Ver
    hongkong
    Posts
    15

    how to get the specific time group for lookup a cell input?

    for example i got a table:
    d e
    1 a 10:00-12:00
    2 b 12:00-14:00
    3 c 14:00-16:00

    in cell a1 input a time,e.g. 10:05, how can i get the "a" in cell b1?
    e.g. input 14:15 in cell a1 then get the result "c" in cell b1. thx experts!

  2. #2
    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 get the specific time group for lookup a cell input?

    Quote Originally Posted by tinyau View Post
    for example i got a table:
    d e
    1 a 10:00-12:00
    2 b 12:00-14:00
    3 c 14:00-16:00

    in cell a1 input a time,e.g. 10:05, how can i get the "a" in cell b1?
    e.g. input 14:15 in cell a1 then get the result "c" in cell b1. thx experts!
    If A1 = 12:00 what result would you expect, A or B?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: how to get the specific time group for lookup a cell input?

    with index / match or with VLookup if you are willing to change the layout.

    See also the question in #2 from Tony Valko
    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.

  4. #4
    Registered User
    Join Date
    02-15-2016
    Location
    hongkong
    MS-Off Ver
    hongkong
    Posts
    15
    Quote Originally Posted by Tony Valko View Post
    If A1 = 12:00 what result would you expect, A or B?
    oh yes。if it is posible,12:00 belongs to b。

  5. #5
    Registered User
    Join Date
    02-15-2016
    Location
    hongkong
    MS-Off Ver
    hongkong
    Posts
    15
    Quote Originally Posted by oeldere View Post
    with index / match or with VLookup if you are willing to change the layout.

    See also the question in #2 from Tony Valko
    layout doesn 't matter.

    really thx experts!

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,512

    Re: how to get the specific time group for lookup a cell input?

    Create table as shown below in columns E and F

    10:00 a
    12:00 b
    14:00 c

    format first column as hh:mm

    with time in A1 then in B1 =VLOOKUP(A1,E1:F3,2,1)
    Last edited by JohnTopley; 02-21-2016 at 01:43 PM.

  7. #7
    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 get the specific time group for lookup a cell input?

    Quote Originally Posted by tinyau View Post
    oh yes。if it is posible,12:00 belongs to b。
    OK, you don't need the end time for the intervals but it makes it easier to see the full interval.

    I'll assume your times are in whole minutes.

    Data Range
    A
    B
    C
    D
    E
    F
    1
    12:45
    B
    From
    To
    2
    A
    10:00
    11:59
    3
    B
    12:00
    13:59
    4
    C
    14:00
    15:59
    5
    ------
    ------
    ------
    ------
    ------
    ------


    Create the table in D1:F4.

    Then, this formula entered in B1:

    =LOOKUP(A1,E2:E4,D2:D4)

    A couple of bits of info...

    If the time entered in A1 is less than the lowest time value in the table then the formula will return the #N/A error. We can account for that if you tell us what version of Excel this has to work in and what result you would rather get.

    If the time entered in A1 is greater than the highest time value in the table then the formula will return the last (bottom-most) value from column D. If you don't want that then tell us what result you do want.

  8. #8
    Registered User
    Join Date
    02-15-2016
    Location
    hongkong
    MS-Off Ver
    hongkong
    Posts
    15

    Re: how to get the specific time group for lookup a cell input?

    thz tony,would you mind unload the excel file for asking more details ?

    i m using excel2010

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,512

    Re: how to get the specific time group for lookup a cell input?

    Sample file with Tony and my formulae.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,512

    Re: how to get the specific time group for lookup a cell input?

    Formulae with ERROR handling
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-15-2016
    Location
    hongkong
    MS-Off Ver
    hongkong
    Posts
    15

    Re: how to get the specific time group for lookup a cell input?

    thx john and tony.
    i can complete the task.
    thz a lot^^

  12. #12
    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 get the specific time group for lookup a cell input?

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA to search a group of cells and input a message if a value is missing from the group
    By ntaylor652 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-19-2014, 05:30 AM
  2. [SOLVED] Vlookup in UserForm - Get Input from listbox, Lookup in specific table from specific sheet
    By s2jrchoi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2013, 09:00 AM
  3. Replies: 6
    Last Post: 06-14-2013, 04:02 PM
  4. [SOLVED] input date column A, increment B, select blank cell in D and input time. in a macro
    By jeffstu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2012, 11:19 AM
  5. How to allow a specific group of value can be input?
    By silvermoon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2012, 04:31 AM
  6. Input account group in corresponding cell
    By minjak in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2011, 10:02 AM
  7. [SOLVED] Display contents of a specific cell even if a group of cells is mo
    By Larry Heine in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-03-2005, 04:06 PM
  8. Replies: 1
    Last Post: 01-18-2005, 02:06 PM

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