+ Reply to Thread
Results 1 to 18 of 18

Add Cells based on conditions and number

  1. #1
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Add Cells based on conditions and number

    Hi,

    Its been a while,

    Can I please get some help with attached file.

    I wound like to add together worked hrs for employees.

    conditions
    Monday-Friday 8 hrs normal time between 8-10hrs time half and double there after
    Saturday 1st 4hrs time half rest double
    all night work paid time half, yes no box- box will also be blank for no

    results to show on corrosponding line.

    thanks
    Attached Files Attached Files


  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    Please explain this again:

    all night work paid time half, yes no box- box will also be blank for no


    I do not know what you mean!!
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Add Cells based on conditions and number

    This answer removed - doesn't work
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Add Cells based on conditions and number

    in K3 =SUM(IF(C3:D3>8,8,C3:D3))+SUM(IF(G3:I3>8,8,G3:I3)) entered as an array shft ctrl enter
    in L3 =SUM(C3:I3)-M3-K3
    in M3 =SUM(IF(C3:D3>10,C3:D3-10,0))+SUM(IF(E3:F3>4,E3:F3-4,0))+SUM(IF(G3:I3>10,G3:I3-10,0)) entered as an array shft ctrl enter

    for night shift either sum everything (but I am unsure about night shifts om weekends), but hopefully a start

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    I think that this is it. None of the formulae multiply 1.5 time by 1.5, or double by 2....

    K3: =IF(B2<>"",SUM(IF($C4:$I4="Yes",0,IF(C3:I3>8,8,C3:I3))),"")

    L3: =IF($B2<>"",SUM(IF($C4:$I4="Yes",$C3:$I3,IF($C3:$I3>10,2,IF($C3:$I3>8,$C3:$I3-8)))),"")

    M3: =IF($B2<>"",SUM(IF($C4:$I4="Yes",0,IF($C3:$I3>10,$C3:$I3-10))),"")

    all are array formulae.

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Add Cells based on conditions and number

    Thanks guys,

    davsth, mostly there though, I don't think cheeking night work.

    with the yes no cell, if cell is blank or no. process as a day shift. 8hrs normal 2hrs 1.5 rest 2 and weekend Saturday 1st 4 1.5X and rest 2x.
    (note) all sunday day is double time.

    if cell is yes the employee has worked a night shift, all night shift is paid 1.5x normal rate. this does include weekend nights

  7. #7
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Add Cells based on conditions and number

    Ahhh I now know why I loved this forum.

    glenn,, thanks near bang on. just not calculating weekend day rates correctly.

    thanks guys, I am real poor at formulas.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    Oh **** !! I never noticed that bit....

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    K3:
    =IF($B2<>"",SUM(IF($C4:$I4="Yes",0,IF($C$1:$I$1="Saturday",0,IF($C$1:$I$1="Sunday",0,IF($C3:$I3>8,8,$C3:$I3))))),"")

    L3: =IF($B2<>"",SUM(IF($C4:$I4="Yes",0,IF($C$1:$I$1="Saturday",IF($C3:$I3>4,4,$C3:$I3),IF($C$1:$I$1="Sunday",IF($C3:$I3>4,4,$C3:$I3),IF($C3:$I3>10,2,IF($C3:$I3>8,$C3:$I3-8)))))),"")

    M3:
    =IF($B2<>"",SUM(IF($C$1:$I$1="Saturday",IF($C3:$I3>4,$C3:$I3-4),IF($C$1:$I$1="Sunday",IF($C3:$I3>4,$C3:$I3-4),IF($C4:$I4="Yes",0,IF($C3:$I3>10,$C3:$I3-10))))),"")
    Attached Files Attached Files

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    Still not right. I just noticed your change in requirement (maybe clarification of requirement is less grumpy-sounding) about sundays.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    One more go. if this is incorrect, for the sheet attached HERE, tell me WHICH answers are incorrect, and what each incorrect answer should be.
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Add Cells based on conditions and number

    Sorry didn't mean to come off grumpy, though who doesn't get grumpy working sundays (lol)
    I see I added that late, sorry about that.

    everything else looks, sweet

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    It was me that was getting grumpy... having to have another go at it 'cos i didn't read it correctly first (or second...) time round. Anyhow...

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  14. #14
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Add Cells based on conditions and number

    I think we need another if yes/no in there. as its not working for night shift at time half.

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    Post a sheet showing what you mean.

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    Forget it. It was obvious....
    Attached Files Attached Files

  17. #17
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Add Cells based on conditions and number

    Whoooottt,

    Thanks for the time and help from everyone involved. gleen cheers for sticking it through.

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Add Cells based on conditions and number

    A bit of a marathon... but we got there!!!

+ 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] Extract number based on conditions
    By Sekars in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-28-2017, 08:34 AM
  2. [SOLVED] How to trigger userform based on a number of different conditions?
    By danbates in forum Excel General
    Replies: 4
    Last Post: 10-09-2017, 01:39 AM
  3. Counting the number of a occurrences based on 2 conditions
    By nealcaffrey in forum Excel General
    Replies: 2
    Last Post: 07-09-2015, 09:55 AM
  4. Return value based on a number of conditions
    By scottwc in forum Excel General
    Replies: 12
    Last Post: 08-29-2014, 02:02 AM
  5. Merging two spreadsheets using VBA based on a number of conditions
    By methuselah90 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-15-2014, 11:26 AM
  6. [SOLVED] Calculation Based upon a number of conditions.
    By halfpint123 in forum Excel General
    Replies: 5
    Last Post: 08-28-2012, 09:59 AM
  7. [SOLVED] count number of cells based on TWO conditions (2 different columns
    By Troi-Xanh in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2005, 09: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