+ Reply to Thread
Results 1 to 10 of 10

can if then else be used in a formula

  1. #1
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    can if then else be used in a formula

    hi
    can you use if then else in a formula like
    if a1 07:00hrs is less than f1 08:00hrs then difference is1
    what im trying to do is our working day is 08:00 to 16:30, 0700=0800 is o/t1.5 but 00:00 to 07:00 is o/t2,else 08:00 to 16:30 is single ,so if I go to work at 06:00 I would have 1 at x2 and 1 atx1.5, and 8 hrs at normal time,how could this look in a formula have tried a few today but getting tied up in knots
    cheers colin
    Last edited by cfinch100; 10-14-2013 at 03:21 PM.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,108

    Re: can if then else be used in a formula

    if then else - you can use

    if, test , true , false
    which you can do a

    if , test , true, if , test, true , false

    =IF( A1 < F1 , 1


    if your start hour is in A1,

    =IF(A1<=TIME(8,0,0), 1,0) that will test if the start time was before 8:00

    =IF(A1<=TIME(8,0,0), HOUR(TIME(8,0,0)-A1),0)
    will calculate how many hours are before 8:00

    so you could now multiply that by the 1.5 rate
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: can if then else be used in a formula

    I messed around a little, don't know if this helps.
    Attached Files Attached Files

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: can if then else be used in a formula

    Hello cfinch100,

    I find your post quite confusing. Why don't you upload a sample Workbook of the layout and the expected outcome. We may then be in a better position to reply with a ready solution.

    Regards
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: can if then else be used in a formula

    hi etaf
    that was exactly what I wanted to do ,can now try and expand it to after 16:30 now
    many thanks cheers colin

  6. #6
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: can if then else be used in a formula

    hi millz
    yes that helps lots as well ,should be able to sort from here for a while
    many thanks colin

  7. #7
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: can if then else be used in a formula

    hi millz
    have been playing with this most of day and stuck again, all works till 16:30, from 16:30 till 20:00 its 1.5 and then x2 to midnight where yours takes over have tried changing 1/24* to various settings just not sure how this was set up any chance of few pointers please
    cheers colin

  8. #8
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: can if then else be used in a formula

    Maybe post what you have so far? I don't know how you determine when did the working hours stop counting, another cell with Time end?

  9. #9
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: can if then else be used in a formula

    hi millz
    this is what I have row 9 does mon to thurs from 0000 to 1630 ,0000 to 0600 is rate x2 ,0700 to 0800 is x1.5 and 8 hrs to 1630,having trouble using formula fro 1630 to 1900 rate x1.5 then 1900 t0 2400 rate x2,have tried various ones just getting in a muddle now ,was going to use separate one row26 for second part of day ,how can you tell exc el what time you want it to start from ,or am I going wrong way about it
    cheers colin
    Attached Files Attached Files

  10. #10
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: can if then else be used in a formula

    Hi cfinch100, sorry about the late reply, I looked but didn't have time to post something and then forgotten about it.

    I don't know if you have already come up with a solution, but it seems like this is getting more complicated. You probably will need to subtract using both date and time.

    You would need a start date+time, and an end date+time to effectively calculate it.

+ 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. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04: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