+ Reply to Thread
Results 1 to 12 of 12

Dropdown boxes and military time

  1. #1
    Registered User
    Join Date
    11-06-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    10

    Dropdown boxes and military time

    Hi. I have a little experience with Excel but I need to do two things beyond my expertise.

    (1) I have dropdown boxes and they work fine when the box is opened and an item is selected. After an item is selected it is auto-recognized next time the first letter of a box item is typed. Is there any way to get it to auto-recognized the first time without using the dropdown box. For example, if the drop down box has words ‘blue, red, yellow, green’ it does not recognize ‘blue’ when I type ‘‘b’ until it is first selected from the menu, then subsequent entries of ‘b’ are recognized as ‘blue.’

    (2) This one is more complex. I need to do T-V=W where T is military time without colons, V is another military time without colons and W is total hours and minutes. It gets further complicated because the military times can cross over two days. Such as: Tuesday night 2300 – Wednesday morning 0430 = 5:30 total minutes.

    Thank you very much for any help you can provide.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Dropdown boxes and military time

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    11-06-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Dropdown boxes and military time

    Attached is a brief January worksheet with the columns in questions. All other data is removed because it is unrelated to the issue. Column H is Race. The dropdown works fine when the first letter is typed but each month when the page starts new the first letter is not reognized until the entire word is typed in or the dropdown word is selected at least once. For example, if you clear contents in column H and try to type in one of the words in the dropdown for the first time, it won't auto-recognize it. It must be selected from dropdown or type in the entire word/phrase, then it will recognize subsequent partial type entires.

    The other colums are T (military time) - V (military time) = W (total hours:minutes.) Note that this will often need to cross over midnight into the next morning as noted in my previous post.

    Thanks for your help.
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Dropdown boxes and military time

    Your sheet is using Data Validation lists. What is happening is that Excel is recognising that you may be attempting to type a word that has already been used in the column & is offering it as a suggestion. This has nothing to do with the Data Validation, it occurs automatically in any Column. I think it is a default setting but it can be switched on or off from Tools -> Options & select Enable Autocomplete for cell values.

    What you want would be available with a ComboBox but I wouldn't use that many Comboboxes in a sheet

  5. #5
    Registered User
    Join Date
    11-06-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Dropdown boxes and military time

    Quote Originally Posted by royUK View Post
    Your sheet is using Data Validation lists. What is happening is that Excel is recognising that you may be attempting to type a word that has already been used in the column & is offering it as a suggestion. This has nothing to do with the Data Validation, it occurs automatically in any Column. I think it is a default setting but it can be switched on or off from Tools -> Options & select Enable Autocomplete for cell values.

    What you want would be available with a ComboBox but I wouldn't use that many Comboboxes in a sheet
    Thank you. Any ideas on how to do the military time calculation in the second part of my question?

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Dropdown boxes and military time

    Put this formula in W2 and copy down:

    =(TIME(LEFT(V2,2), RIGHT(V2,2), 0)) - (TIME(LEFT(T2,2), RIGHT(T2,2), 0)) + (1*(V2<T2))

    Format those cells for h:mm.

    There's an error in the data for V40. It's still getting the right answer but that's accidental. Make sure all the cells have 4-digit entries to avoid an actual miscalculation.
    Last edited by JBeaucaire; 11-07-2010 at 10:51 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Dropdown boxes and military time

    Is it the
    Left,Right,Left,Right

    that makes it military?

  8. #8
    Registered User
    Join Date
    11-06-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Dropdown boxes and military time

    Quote Originally Posted by davesexcel View Post
    Is it the
    Left,Right,Left,Right

    that makes it military?
    I formatted cells T, V & W with custom h:mm, and added your formula to W as Validation/custom/ =(TIME(LEFT(V1,2), RIGHT(V1,2), 0)) - (TIME(LEFT(T1,2), RIGHT(T1,2), 0)) + (1*(V1<T1)) but it does not auto-calculate for cell W. I also must use : in the military time or it changes times to 0:00

    Example: T=19:00, V= 21:30, so W should be auto-calculated as 2:30 but nothing happens in W. It stays blank.

    Also, and exmapkle crossing midnight should be 2300-0200 = 3:00

  9. #9
    Registered User
    Join Date
    11-06-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Dropdown boxes and military time

    Quote Originally Posted by DrEd View Post
    I formatted cells T, V & W with custom h:mm, and added your formula to W as Validation/custom/ =(TIME(LEFT(V1,2), RIGHT(V1,2), 0)) - (TIME(LEFT(T1,2), RIGHT(T1,2), 0)) + (1*(V1<T1)) but it does not auto-calculate for cell W. I also must use : in the military time or it changes times to 0:00

    Example: T=19:00, V= 21:30, so W should be auto-calculated as 2:30 but nothing happens in W. It stays blank.

    Also, and example crossing midnight should be 2300-0200 = 3:00
    Military time begins at midnight 0000, each minute adds 1 such as 0001 is 1 minute after midnight. There is no a.m. or p.m. Noon is 1200, 1pm is 1300, 11:59 pm is 2359 then starts with 0000 next day. Not sure what you mean by 'left, right.'

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Dropdown boxes and military time

    This is all I meant, I put that formula in W2 and formatted properly, copied down.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-06-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Dropdown boxes and military time

    Quote Originally Posted by JBeaucaire View Post
    This is all I meant, I put that formula in W2 and formatted properly, copied down.
    You are a genius. Thanks!

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Dropdown boxes and military time

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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