+ Reply to Thread
Results 1 to 17 of 17

help to resolve IF statement that calculates 2 sums to zero with certain variables in calc

  1. #1
    Registered User
    Join Date
    05-19-2013
    Location
    us
    MS-Off Ver
    Excel 2007
    Posts
    8

    help to resolve IF statement that calculates 2 sums to zero with certain variables in calc

    I am using the following [=IF(AA12=1,IF(X12<>0,X12-40,X12),IF(AA12=0.5,IF(X12<>0,X12-29,X12)))] calculation for a plus or minus calculation on a schedule which is based on 29 or 40 hours per week.
    The problem is when scheduled hours = 29 or 40 hours I get a funky result calculation in the cell =IF(AA12>=1,IF(X12<>0,X12-40,X12),IF(AA12=0.5,IF(X12< -7.10543E-15
    >0,X12-29,X12)))
    I have not been able to figure this out
    Anyone have any solutions???

    The 1 = a true statement if full time and the .5 is if it is a part time 29 hours from a check box another sheet.

    The original cell just above calculates perfectly. the cells below give a funky cell result.
    Last edited by daaby; 06-17-2013 at 02:01 PM.

  2. #2
    Registered User
    Join Date
    06-07-2013
    Location
    Colorado
    MS-Off Ver
    Excel 2007 (work), Excel 2013 (home)
    Posts
    5

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    I'm a little confused as to what the issue is that you are running into ...

    I retyped your formula the way that you have it above and it works great. What issue are you encountering?
    If I have helped, add to my reputation

  3. #3
    Registered User
    Join Date
    05-19-2013
    Location
    us
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Quote Originally Posted by DarthMoose View Post
    I'm a little confused as to what the issue is that you are running into ...

    I retyped your formula the way that you have it above and it works great. What issue are you encountering?


    Okay... I add scheduled hours per day on a schedule, if the sum hits the number 29 or 40 the formula breaks down.
    schedule.JPG The first row remains totally functionable. The second row begins the problem

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    May I suggest that you upload a real workbook for DarthMoose or other members to play around since he/she can't duplicate the error.

    Just make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  5. #5
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Quote Originally Posted by daaby View Post
    I am using the following [=IF(AA12=1,IF(X12<>0,X12-40,X12),IF(AA12=0.5,IF(X12<>0,X12-29,X12)))] calculation for a plus or minus calculation on a schedule which is based on 29 or 40 hours per week.
    The problem is when scheduled hours = 29 or 40 hours I get a funky result calculation in the cell =IF(AA12>=1,IF(X12<>0,X12-40,X12),IF(AA12=0.5,IF(X12< -7.10543E-15>0,X12-29,X12)))
    I have not been able to figure this out
    Anyone have any solutions???

    The 1 = a true statement if full time and the .5 is if it is a part time 29 hours from a check box another sheet.

    The original cell just above calculates perfectly. the cells below give a funky cell result.
    I'm currently wondering if you made a typo in your OP....-7.10543E-15 ...not the number itself, but rather the placement within your post, as the formula with it included makes no sense...

    Taking it out of the formula, I get...
    .
    =IF(AA12>=1,IF(X12<>0,X12-40,X12),IF(AA12=0.5,IF(X12<>0,X12-29,X12)))

    ...which makes more sense.

  6. #6
    Registered User
    Join Date
    05-19-2013
    Location
    us
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Yes I added the formula as it is and also added the formula as it breaks when it hits 29 or 40 in the calculations... When it hits 29 or 40 it is at zero over or under in hours... the -7.10543E-15 appear in the cell as in the jpg I submitted when the calculation hits 29 or 40... What is strange is the fact the first row calculates correctly with no problems. it is the next row that produces this error in calculation; and i also might point out all rows under the first row do the same thing.
    Last edited by daaby; 06-17-2013 at 11:21 PM.

  7. #7
    Registered User
    Join Date
    06-07-2013
    Location
    Colorado
    MS-Off Ver
    Excel 2007 (work), Excel 2013 (home)
    Posts
    5

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Quote Originally Posted by vlady View Post
    May I suggest that you upload a real workbook for DarthMoose or other members to play around since he/she can't duplicate the error.

    Just make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.
    This would help greatly as when I have the formula typed manually into a new spreadsheet I'm not encountering any errors

  8. #8
    Registered User
    Join Date
    05-19-2013
    Location
    us
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Quote Originally Posted by DarthMoose View Post
    This would help greatly as when I have the formula typed manually into a new spreadsheet I'm not encountering any errors


    I hope this will help some.
    Attached Files Attached Files
    Last edited by daaby; 06-18-2013 at 10:05 PM.

  9. #9
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Well it helps verify what you are seeing... but I cannot determine why. FWIW, setting the cells to Number format "masks" the problem.

  10. #10
    Registered User
    Join Date
    05-19-2013
    Location
    us
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Well I have been through the code a great many times including formatting. I am pretty much a novice at this. I started excel a little over a month ago, but it is similar to php so I caught on fairly well, but not great; yet...Again any insight will be helpful... But I really need the plus or minus hours from 29 and 40 hours, and the 0 hours is also important.
    Now the checkbox when checked gives full time 40 hrs and unchecked gives 29 hours.
    The only odd thing is that the flaw does not occur in the first row. I have been stuck a week on this and it is all I need to complete this portion of my project.

  11. #11
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    instead of =sum(AC6+AE6+AG6+AI6+AK6+AM6+AO6) in column X6 down
    use below. It's precision problem.

    =ROUND(AC6+AE6+AG6+AI6+AK6+AM6+AO6,0)


    edit:
    and btw regarding the formula llike this one..=IF(ISBLANK(B6),"0",SUM((D6-C6+(D6<C6))*24)) do not put quotes just 0

    Regards,
    Vladimir

  12. #12
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Try this formula in X6 and copy down...

    =X6-40+IF(AA6=0.5,11,0)

    (Note formula doesn't include any handling of situations where AA6 may be other than 1 or 0.5)

  13. #13
    Registered User
    Join Date
    05-19-2013
    Location
    us
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Quote Originally Posted by vlady View Post
    instead of =sum(AC6+AE6+AG6+AI6+AK6+AM6+AO6) in column X6 down
    use below. It's precision problem.

    =ROUND(AC6+AE6+AG6+AI6+AK6+AM6+AO6,0)


    edit:
    and btw regarding the formula llike this one..=IF(ISBLANK(B6),"0",SUM((D6-C6+(D6<C6))*24)) do not put quotes just 0

    Regards,
    Vladimir
    Actually I need the total hours scheduled in CX6 and this formula gives the cell a sum of zero. The example does not work as it should. drop downs do not work and neither do the check boxes for full or part time

  14. #14
    Registered User
    Join Date
    05-19-2013
    Location
    us
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Here is a live copy that funtions...
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    As noted by vlady, its a precision problem. It's a result of Excel tracking time values as a decimal value. As such, there will always be rounding errors compounded when performing operations on more than one time value... because each time value is rounded to decimal form. 7 days a week, two time values per day, means the compounded rounding error could be anywhere between 0 and 14 times, inclusive.

    vlady gave you an easy way out as far as modifying your formulas.

  16. #16
    Registered User
    Join Date
    05-19-2013
    Location
    us
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    I understand now what Vlady was saying. Thank you for clarification. Is there anyway around this???
    =ROUND(AC6+AE6+AG6+AI6+AK6+AM6+AO6,0) gives me zero in the cell where I would like to track the total hours. I guess I would have to have two columns one for hours and the other for plus or minus hours... Unless there are any ideas.
    I appreciate everyone's help and education in this matter. I am very novice yet...

  17. #17
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: help to resolve IF statement that calculates 2 sums to zero with certain variables in

    Quote Originally Posted by daaby View Post
    I understand now what Vlady was saying. Thank you for clarification. Is there anyway around this???
    =ROUND(AC6+AE6+AG6+AI6+AK6+AM6+AO6,0) gives me zero in the cell where I would like to track the total hours. I guess I would have to have two columns one for hours and the other for plus or minus hours... Unless there are any ideas.
    I appreciate everyone's help and education in this matter. I am very novice yet...
    You already have two columns as such X and Z, respectively.

    BTW, I notice you time assignments are in 15 minute intervals. You should change the round formula to...

    =ROUND(AC6+AE6+AG6+AI6+AK6+AM6+AO6,0.00)

+ 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