+ Reply to Thread
Results 1 to 12 of 12

Created drop box (shift description) - unable to code cell to report hours

  1. #1
    Registered User
    Join Date
    12-24-2012
    Location
    Canada, Eh!?
    MS-Off Ver
    Office
    Posts
    17

    Created drop box (shift description) - unable to code cell to report hours

    Merry Christmas/Happy Holidays to all. I'm a new comer to this site - I'm really hoping someone can help me out.

    I have created a shift_timesheet.xls and am hitting a solid 4ft deep brick wall! I'm unable to formulate a code to accept my drop down box (ie. Cell D6), to automatically report (hours) on another cell (D7). My drop down box has roughly 10 different shifts we use here at work, and I would like to select the shift (D6), and it report that shifts hours in cell D7.

    I hope this makes sense. I've attached an image so you can see where im coming from.

    mdurkin
    Last edited by mdurkin; 12-24-2012 at 12:45 PM.

  2. #2
    Forum Contributor dogberry's Avatar
    Join Date
    07-15-2012
    Location
    Wales, UK
    MS-Off Ver
    Excel 2010
    Posts
    624

    Re: Created drop box (shift description) - unable to code cell to report hours

    Hi

    Can you post a sample worksheet so we can see the layout etc dont post confidental information
    it will also get you a much better response.


    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.



    Chris
    Click my star if I helped Thanks

  3. #3
    Registered User
    Join Date
    12-24-2012
    Location
    Canada, Eh!?
    MS-Off Ver
    Office
    Posts
    17

    Re: Created drop box (shift description) - unable to code cell to report hours

    Sorry guys - quick on the draw!Timesheet_aa.xlsx
    Last edited by jeffreybrown; 12-24-2012 at 11:48 AM.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: NOT SOLVED! - Created drop box (shift description) - unable to code cell to report hou

    With your sample file, are you looking for

    D7 =MID(D5,FIND("(",D5)+1,FIND(")",D5)-FIND("(",D5)-1)

    If not, how about showing a sample of what you expect.
    HTH
    Regards, Jeff

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: NOT SOLVED! - Created drop box (shift description) - unable to code cell to report hou

    The expected result is 21:00-17:00 = 4 hours?
    If yes, in D7:
    =MID(D5,LEN(D5)-4,2)-MID(D5,LEN(D5)-9,2)
    Hope this help
    Quang PT

  6. #6
    Registered User
    Join Date
    12-24-2012
    Location
    Canada, Eh!?
    MS-Off Ver
    Office
    Posts
    17

    Re: NOT SOLVED! - Created drop box (shift description) - unable to code cell to report hou

    Quote Originally Posted by bebo021999 View Post
    The expected result is 21:00-17:00 = 4 hours?
    If yes, in D7:
    =MID(D5,LEN(D5)-4,2)-MID(D5,LEN(D5)-9,2)
    Hope this help
    Hi there, thanks for the response -

    My issue is that MID(D5,LEN(D5)-4,2)-MID(D5,LEN(D5)-9,2) makes my answer -16 when I choose Night (2300-0700). I also get 9 hours when I chose my REB (0730-1600)..instead of 8.5... how can I fix this?

  7. #7
    Registered User
    Join Date
    12-24-2012
    Location
    Canada, Eh!?
    MS-Off Ver
    Office
    Posts
    17

    Re: NOT SOLVED! - Created drop box (shift description) - unable to code cell to report hou

    Hi jeff,

    I'm looking to have a drop down list with my shifts (row 6), and have the total hours for that shift fall under it (row 7). Example - if a shift runs from 2300-0700 hrs (row 6), I would like row 7 to be filled in with the answer = being 8 hours. The same goes for the rest of the shifts in the drop down... I hope this explains things. Thank you very much for your time - I really do appreciate it.

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: NOT SOLVED! - Created drop box (shift description) - unable to code cell to report hou

    IMO, the easiest and cleanest solution would be, in column B (Sheet18) right next to the shift, write in the number of hours.

    Then use a vlookup (Sheet2) to return the hours.

    =VLOOKUP(D5,Sheet18!$A$4:$B$17,2,0)

    Now if you want the word hours to show up, on the cell with the vlookup use a custom format of 0" Hours"

    Doing it this way will allow you to add up hours later if need be since they are numbers.
    Attached Files Attached Files

  9. #9
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Created drop box (shift description) - unable to code cell to report hours

    If you find it inconvernience in helper columns/sheet/area,
    try this formula in D7:
    Please Login or Register  to view this content.

  10. #10
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: NOT SOLVED! - Created drop box (shift description) - unable to code cell to report hou

    I just found the shorter:
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    12-24-2012
    Location
    Canada, Eh!?
    MS-Off Ver
    Office
    Posts
    17

    Re: NOT SOLVED! - Created drop box (shift description) - unable to code cell to report hou

    @jeffreybrown

    Thats perfect! Thank you very much - this works out great! Except I'm still getting 9 hours when it should read 8.5
    Last edited by jeffreybrown; 12-24-2012 at 03:41 PM.

  12. #12
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Created drop box (shift description) - unable to code cell to report hours

    You need to set the decimals for the cell.

    If you click on the 9 and look in the formula bar you should see 8.5

+ 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