+ Reply to Thread
Results 1 to 11 of 11

Work Rota system- reading text to work out hours

  1. #1
    Registered User
    Join Date
    11-06-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    7

    Work Rota system- reading text to work out hours

    Hello experts,

    I am trying to create work rota system, and would really appreciate some help.

    The concept is the user enters the shift into a cell (A1) either as a code ‘E’(early shift)/’L’(late Shift) or as a specific time e.g ‘2-7’. Both are in a text format. And I want the other cell (B1) to calculate the number of hours in that shift:

    A1= E
    B1= 8

    and

    A1= 2-7
    B1= 5


    For the first example, I have created a search function in combination with ‘if’ statements, to check to see if the user has entered either E/L. that’s working perfectly, (the last if statement is for the manual entry of the shift which I am having difficulties with):

    =IF(ISNUMBER(SEARCH("E",A1)),8,IF(ISNUMBER(SEARCH("L",D9)),7,IF([HELP_NEEDED]))

    The issue I am having now is trying to figure out how to determine the other shift type, which is also based on text. Ideally I need a way for the formula to read the numbers between the dash (X-Y) and allow me to manipulate the values (minus Y from X to give the hours of the shift in an integer format). But heres where it gets more tricky some times the shift could even be ‘2:30-5’. Which is a 4.5 hour shift. To do this I would have to do ‘Y – (X+ 0.2)’. is there a way of determining if one of the integers is a float?(decimal point). Therefore the dash should be the splitting point between the 2 numbers.

    I do understand there could be much easier ways to do this if separate cells were used to enter the X & Y times. But the coluge I am doing this is not very computer literate and prefers to have this format. Also she tends to enter the time with a colon (2:30) would this be an issue, or could it be possible to make excel convert the text with the colon to a an integer with a decimal.

    Would anyone know how to do this? Or how to go about doing this?

    Thank you very much
    Last edited by cubb; 11-12-2012 at 08:45 AM.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Work Rota system- reading text to work out hours

    Hi Cubb,

    Welcome to the forum.
    Please upload a sample workbook to support your query.. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    11-06-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Work Rota system- reading text to work out hours

    hi DILIPandey hope you are well,

    thank you for the warm welcome, my grandmother is in india as well, visiting our home town.

    ok i have attached the document to this. please have a look and let me know if you do come up with any solutions

    regards
    Attached Files Attached Files

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Work Rota system- reading text to work out hours

    some times the shift could even be ‘2:30-5’. Which is a 4.5 hour shift.
    According to me it's 2.5 hrs shift.

    anyways, try using below formula:-
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See attached:- work rota v1.0.xlsx

    I have applied data validation to the time entry area, so now no one will be able to put time as in time with : sign.. hence 4:50 can be entered as 4.5 only

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  5. #5
    Registered User
    Join Date
    11-06-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Work Rota system- reading text to work out hours

    [QUOTE]According to me it's 2.5 hrs shift. /QUOTE]

    haha i guess i forgot how to count lol


    thank you so much, the formula worked perfectly and did exactly what i wanted. you even took into consideration am/pm times. thank you very much

    very clever trick with the data validation

    thanks again

  6. #6
    Registered User
    Join Date
    11-06-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Work Rota system- reading text to work out hours

    Hi DILIPandey,

    i was wondering if you could help me with one last thing.

    i was trying to amend the formula so that if a manual shift was entered (11-8) it would check if the shift (VALUE) was more than 8 if so it would minus 1 hour (for lunch). i placed 2 identical IF statements in the, true and false value of the other IF statement you created, but its not working for some reason.

    the IF statement is bellow, or alternatively i have attached the spreadsheet again the formula is in cell T8:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    thanks alot
    Attached Files Attached Files

  7. #7
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Work Rota system- reading text to work out hours

    HI Cubb,

    To achieve this you can simply use the logic like... if(formula>8,formula-1,formula).. done the same in attached workbook... thanks.

    work rota v1.2.xlsx

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-06-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Work Rota system- reading text to work out hours

    fantastic it worked perfectly.

    thank you for all the help you provided me

    regards

  9. #9
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Work Rota system- reading text to work out hours

    you are welcome cubb..

    Cheers

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  10. #10
    Registered User
    Join Date
    11-10-2014
    Location
    london
    MS-Off Ver
    2013
    Posts
    1

    Re: Work Rota system- reading text to work out hours

    Hey guys what if you want to add more shifts / more if Statements, how would that work.

  11. #11
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Work Rota system- reading text to work out hours

    cid88,
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

+ 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