+ Reply to Thread
Results 1 to 11 of 11

Excel 2008 : RESOLVED Configuring Nested IF Logic

  1. #1
    Registered User
    Join Date
    11-22-2010
    Location
    Dallas, Oregon
    MS-Off Ver
    Excel 2010
    Posts
    13

    Unhappy RESOLVED Configuring Nested IF Logic

    I am trying to generate an IF statement that will take the data in cell D7 and if it is more than 4 the result is 15, if it is between 2 and 4 years, the result is 10, if it is between 1 and 2 years, the result is 5, if it is less than 1, the result is 0.

    What I have is =IF(AND(B7="FT",D7>=4),15,IF(OR(B7="FT",D7>=2<=4),10,IF(OR(B7="FT",D7>=1<=2),5,
    IF(OR(B7="FT",D7=0),0)))

    The result is always 10, even if the cell is 4 or greater.

    What have I got that is wrong and can you help?

    Excel 2010 on the Windows Partition
    Excel 2011 on the Mac Partition.
    Last edited by baraktorvan; 11-27-2010 at 09:39 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Nested IF statement and I am confused.

    You don't mention the significance of FT in your narrative but based on combination of original formula and original narrative:

    Please Login or Register  to view this content.
    or, assuming the step of 5 to always be constant (going forward)

    Please Login or Register  to view this content.
    In both cases it is assumed that D7 is a number (and not number stored as text - if so change SUM to N and encase 2nd reference to D7 with N also)

    I modified your title slightly - please keep focused on specifics of problem.

  3. #3
    Registered User
    Join Date
    11-22-2010
    Location
    Dallas, Oregon
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Configuring Nested IF Logic

    Thanks for the help and for the the title edit-that will help in the future.

    The FT is text indicating a full time employee, PT would be used for part time employees. The text of D7 is the result of the formula =DATEDIF(C6,Z6, "Y").

    Basically this spreadsheet is used to calculate vacation leave and paid family care time.

    For vacation we grant 15 days after 4 years, 10 days between 2 and four years, 5 days from 1-2 years, and none if you have less than 1 year based on calendar years and not date of hire. The revised formula works perfectly and I thank you for the edits!

    For paid family care, we have 5 paid days off if you are greater than one year, 3 days if you have worked for less than one year or if you are part time having worked more than 1.5 years. I haven't started on that formula yet.

    I hope that makes my intention clearer! Thanks again for your help.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Configuring Nested IF Logic

    Quote Originally Posted by baraktorvan
    For paid family care, we have 5 paid days off if you are greater than one year, 3 days if you have worked for less than one year or if you are part time having worked more than 1.5 years.
    If you're looking for a solution to the above (unclear) then one possibility:

    Please Login or Register  to view this content.
    Note however that a DATEDIF function using "y" will not give you partial years - ie you will never get 1.5 result.
    On that basis you might wish to consider converting from "y" based test to "m" based test in the DATEDIF and work from the monthly figure (eg 12 for 1 year, 18 for 1.5 years etc...)
    Last edited by DonkeyOte; 11-22-2010 at 04:41 AM. Reason: forgot QUOTE tags - oops

  5. #5
    Registered User
    Join Date
    11-22-2010
    Location
    Dallas, Oregon
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Configuring Nested IF Logic

    Exactly what I came up with on my own. Thanks so much!

    But I have run into an additional snag. I have to create a summary sheet that calculates the number of vacation leave days remaining based on the number of days originally granted.

    So on my new worksheet, I have in the text 15 day in B4, 10 day in B5, 5 day in B6, and None in B7.

    In E4-E7 I want to take the total days remaining for each of the allotments (the 15 day, 10 day, 5 day and 0 day) based on the individual use recorded on the Leave worksheet. In my head, I am saying "Sum the total number of days remaining on the Leave worksheet for each employee who earns 15 days per year and put it on the Summary table."

    I came up with =IF(AND(Leave!E6:E110=15),SUM(Leave!G9:G110),0) but that is coming up with a #Value error and I cannot figure out why. The workbook is attached.
    Attached Files Attached Files
    Last edited by baraktorvan; 11-22-2010 at 03:50 PM.

  6. #6
    Registered User
    Join Date
    11-22-2010
    Location
    Dallas, Oregon
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Configuring Nested IF Logic

    So I guess everyone is kinda stuck like I am. :-(

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Configuring Nested IF Logic

    Have you looked at SUMIF:

    e.g.

    In E4: =SUMIF(Leave!E6:E110,15,Leave!G9:G110)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  8. #8
    Forum Contributor
    Join Date
    11-25-2010
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    120

    Re: Configuring Nested IF Logic

    Hi there,

    You could use SUMIF but if you changed your formula a little it would work provided you check your cell references.

    I've attached your original workbook so you can see what I've done. Basically changed the [I]days remaining[I] formula to an array formula:

    {=SUM(IF(Leave!$E$6:$E$110=$A4,Leave!$G$6:$G$110,0))}

    You need to use Ctrl+Shift+Enter when you enter it. I've put the allocations in cells A4:A7 so if they are changed the formulas can stay the same.

    As mentioned above you need to check your cell references when dragging formulas, the ones in C5:C7 where mising data when you dragged it down the original range moved down as well.

    =COUNTIF(Leave!E6:E107,15)

    Use F4 to lock the references.

    =COUNTIF(Leave!$E$6:$E$107,15)
    Attached Files Attached Files

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Configuring Nested IF Logic

    So why does the Sumif formula need to be changed to an Array formula:

    Why not just?

    =SUMIF(Leave!$E$6:$E$110,$A4,Leave!$G$6:$G$110)

  10. #10
    Registered User
    Join Date
    11-22-2010
    Location
    Dallas, Oregon
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Configuring Nested IF Logic

    I tried that formula, and the result was a 0 days remaining when I used it for the first 15 day row.

    When I used the Array formula, it came up with the correct amount of days when I counted them individually.

    I am not sure why it did not work, I am still very new with nested IF logic.

    Quote Originally Posted by NBVC View Post
    So why does the Sumif formula need to be changed to an Array formula:

    Why not just?

    =SUMIF(Leave!$E$6:$E$110,$A4,Leave!$G$6:$G$110)

  11. #11
    Registered User
    Join Date
    11-22-2010
    Location
    Dallas, Oregon
    MS-Off Ver
    Excel 2010
    Posts
    13

    Thumbs up Re: Configuring Nested IF Logic

    Thanks so much Lifesigns! That worked much better than my own IF statement! You just saved my bacon as this report is due on Monday and I was not looking forward to banging my head all weekend long!

    Quote Originally Posted by Lifesigns View Post
    Hi there,

    You could use SUMIF but if you changed your formula a little it would work provided you check your cell references.

    I've attached your original workbook so you can see what I've done. Basically changed the [I]days remaining[I] formula to an array formula:

    {=SUM(IF(Leave!$E$6:$E$110=$A4,Leave!$G$6:$G$110,0))}

    You need to use Ctrl+Shift+Enter when you enter it. I've put the allocations in cells A4:A7 so if they are changed the formulas can stay the same.

    As mentioned above you need to check your cell references when dragging formulas, the ones in C5:C7 where mising data when you dragged it down the original range moved down as well.

    =COUNTIF(Leave!E6:E107,15)

    Use F4 to lock the references.

    =COUNTIF(Leave!$E$6:$E$107,15)

+ 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