+ Reply to Thread
Results 1 to 21 of 21

Formula to add cells with a minmum result

Hybrid View

  1. #1
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Formula to add cells with a minmum result

    I have a timesheet template that I want to add the total hours worked but have the result be at least 7.6. Our employees are paid 7.6 hours per day but only work 7.5, so they accrue their RDO. My formula I have so far is =((D6-B6)*24)-C6

    for example:

    Date Start Lunch Finish Total
    14/05/15 (Thu) 9:00 AM 1 5:30 PM 7.50
    15/05/15 (Fri) 9:00 AM 1 5:30 PM 7.50

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: Formula to add cells with a minmum result

    Try:
    Formula: copy to clipboard
    =max(7.6,((D6-B6)*24)-C6)
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to add cells with a minmum result

    That's close. The only problem is if the employee didn't work that day it will put 7.6 hours, which I need it to say 0.00hrs.TEMPLATE - Timesheet.xlsm

  4. #4
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to add cells with a minmum result

    An IF function would be good ()) but I can't join the two formulas together

    Existing formula
    =((D6-B6)*24)-C6 then some how add =IF(E6=7.5,0.1,0).....

  5. #5
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to add cells with a minmum result

    Something like this, but one that works...mine doesn't =((D6-B6)*24)-C6,(IF(7.5,0.1,0))

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Formula to add cells with a minmum result

    =text(mod(d6-b6,1)*24-c6,"0.00")
    try this
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  7. #7
    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
    30,914

    Re: Formula to add cells with a minmum result

    Do you mean:

    =IF(((D6-B6)*24)-C6=7.5,0.1,0)

  8. #8
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: Formula to add cells with a minmum result

    Formula: copy to clipboard
    =IF(OR(B6="",D6=""),"",MAX(7.6,((D6-B6)*24)-C6))

    or if you prefer zeros over empty cells:
    Formula: copy to clipboard
    =IF(OR(B6="",D6=""),0,MAX(7.6,((D6-B6)*24)-C6))

  9. #9
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to add cells with a minmum result

    Getting closer, though if they only work 6hrs I need it to say 6.

    So in a nutshell I need it to add up the hours worked. If up to 7.5 the actual hours worked needs to show, if 7.5 worked it needs to round up to 7.6, if over 7.5 hours worked the total hours worked needs to show.

  10. #10
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: Formula to add cells with a minmum result

    Formula: copy to clipboard
    =IF(OR(B6="",D6=""),"",if(and((D6-B6)*24-C6>=7.7,(D6-B6)*24-C6<=7.6),7.6,(D6-B6)*24-C6)


    May be it would be wise/kind to tell us about all special cases at once ...

  11. #11
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Formula to add cells with a minmum result

    Attach a sample file with some examples and expected result to avoid confusion

  12. #12
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to add cells with a minmum result

    See the attached, use the Test - Fulltime tabTEMPLATE - Timesheet.xlsm. I have placed Kapers formula in E6 but its not working.

  13. #13
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: Formula to add cells with a minmum result

    PS.
    Siva
    Your formula
    Formula: copy to clipboard
    =IF(MOD(D6-B6,1)*24-C6=7.5,7.6,MOD(D6-B6,1)*24-C6)

    will return more than 7.6 if more than 7.6 was reported, while Skumby asked: "I need the cell to be a maximum on 7.6 (even if they work 10hrs)."

  14. #14
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Formula to add cells with a minmum result

    Quote Originally Posted by Kaper View Post
    PS.
    Siva
    Your formula
    Formula: copy to clipboard
    =IF(MOD(D6-B6,1)*24-C6=7.5,7.6,MOD(D6-B6,1)*24-C6)

    will return more than 7.6 if more than 7.6 was reported, while Skumby asked: "I need the cell to be a maximum on 7.6 (even if they work 10hrs)."
    "When they work overtime I want it to show the hours they worked" this is what he was mentioned in Cell I8, in the attached Excel File

  15. #15
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: Formula to add cells with a minmum result

    Have you tried to read and understand the formula - there is obvious (I think) typo:
    Formula: copy to clipboard
    =IF(OR(B6="",D6=""),"",if(and((D6-B6)*24-C6>=7.5,(D6-B6)*24-C6<=7.6),7.6,(D6-B6)*24-C6)

    I was writing on the smartphone - sorry.

  16. #16
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to add cells with a minmum result

    You are so awesome! Thank you!! One more thing (I am being a pain in the a**e, I know) on reflection, to get the total hours to be 38, can it be a max of 7.6 hours for the day. So if they work 10 hours it will only show 7.6hours, but if they work 3hrs it will show 3 hours.

    Heaps sorry for screwing you around.

  17. #17
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Formula to add cells with a minmum result

    Then why you mentioned the below in Cell I6
    "When they work overtime I want it to show the hours they worked"

  18. #18
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to add cells with a minmum result

    Sorry about the confusion. On reflection, I need the cell to be a maximum on 7.6 (even if they work 10hrs) but if they finish early I would like it to say the hours worked. That way I can add the two columns together, Leave and Hours worked, and it will total 38 hrs.

  19. #19
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Formula to add cells with a minmum result

    E6=IF(MOD(D6-B6,1)*24-C6=7.5,7.6,MOD(D6-B6,1)*24-C6)
    Try this and copy towards down

  20. #20
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: Formula to add cells with a minmum result

    Again - reading and understanding is the key. instead of and(les than 7.6 more than 7.5) use just: more than 7.5

    Formula: copy to clipboard
    =IF(OR(B6="",D6=""),"",if((D6-B6)*24-C6>=7.5,7.6,(D6-B6)*24-C6)

  21. #21
    Registered User
    Join Date
    04-30-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to add cells with a minmum result

    You are a LEGEND!!!! Thank you so much!!!!!!!!!!!

+ 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. [SOLVED] how to show cells without its formula, only its result
    By aaaaa34 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 02-05-2015, 02:38 PM
  2. [SOLVED] if condition excel formula from 4 cells values result as of conditions of two cells
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-09-2013, 06:25 AM
  3. Sum a formula result over a range of cells
    By apc22 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-25-2013, 09:02 PM
  4. Replies: 0
    Last Post: 10-16-2012, 04:27 AM
  5. [SOLVED] Need result not formula in cells
    By Bonnie in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 08-07-2006, 09:00 AM

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