+ Reply to Thread
Results 1 to 6 of 6

Nested IF is not working correctly.

  1. #1
    Registered User
    Join Date
    07-30-2014
    Location
    Bangladesh
    MS-Off Ver
    MS Office 2007
    Posts
    6

    Nested IF is not working correctly.

    Pay the house rent, 55% of salary between 5000 to 4100 and 2250 minimum, 50% between 5001 to 10800 and 2500 minimum, 45% between 10801 to 21600 and 4800 minimum, 40% of 21601 to above and 8500 minimum. I've used Nested if function like: "=IF(AND(a2>4100,a2<5000),a2*55%,IF(AND(a2*55%<2500),2500,IF(AND(a2>5001,a2<10800),a2*50%,IF(AND(a2*50%<2800),2800,IF(AND(a2>10801,a2<21600),a2*45%,IF(AND(a2*45%<5400),5400,IF(a2>21601,a2*40%,9700))))))))"

    1st part of the function "=IF(AND(a2>4100,a2<5000),a2*55%,IF(AND(a2*55%<2500),2500" is working but other parts are not.

    Can anybody solve this problem.

    September-14.xls

    Nihar Sharma

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Nested IF is not working correctly.

    Still looking at it, for for anyone else reading here it is in a more broken down view

    =IF(AND(A2>4100,A2<5000),A2*55%,
    IF(AND(A2*55%<2500),
    2500,
    IF(AND(A2>5001,A2<10800),
    A2*50%,
    IF(AND(A2*50%<2800),
    2800,
    IF(AND(A2>10801,A2<21600),
    A2*45%,
    IF(AND(A2*45%<5400),
    5400,
    IF(A2>21601,A2*40%,9700)))))))
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  3. #3
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Nested IF is not working correctly.

    Since you're stepping up through the brackets, the ANDs are logically redundant.

    Well, at any rate, I advise going through a lookup table rather than burying it all in IFs.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Nested IF is not working correctly.

    =IF(AND(A2>4100,A2<5000),A2*55%,
    IF(AND(A2*55%<2500),
    2500,
    IF(AND(A2>5001,A2<10800),
    A2*50%,
    IF(AND(A2*50%<2800),
    2800,
    IF(AND(A2>10801,A2<21600),
    A2*45%,
    IF(AND(A2*45%<5400),
    5400,
    IF(A2>21601,A2*40%,9700)))))))

    If it is NOT greater than 21,601, it will not be 9700 because it is fitting into the criteria for GREEN
    RED doesn't need to be an AND since there is only one expression

    The 9700 will never happen, unless something between 21,600 or 21,601 is entered into column A

    Solution, Less/greater Than or Equal To. And a couple less AND's to shorten it a bit

    =IF(AND(A2>=4100,A2<=5000),A2*55%,
    IF(A2*55%<=2500,
    2500,
    IF(AND(A2>=5001,A2<=10800),
    A2*50%,
    IF(A2*50%<=2800,
    2800,
    IF(AND(A2>=10801,A2<=21600),
    A2*45%,
    IF(A2*45%<=5400,
    5400,
    IF(A2>=21601,A2*40%,9700)))))))

    Flattened:

    =IF(AND(A2>=4100,A2<=5000),A2*55%,IF(A2*55%<=2500,2500,IF(AND(A2>=5001,A2<=10800),A2*50%,IF(A2*50%<=2800,2800,IF(AND(A2>=10801,A2<=21600),A2*45%,IF(A2*45%<=5400,5400,IF(A2>=21601,A2*40%,9700)))))))
    Last edited by Speshul; 08-22-2014 at 03:18 PM.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,673

    Re: Nested IF is not working correctly.

    This will satisfy all the conditions.
    Please Login or Register  to view this content.
    Minimum condition is not necesary.One example here
    Eg;For A2 >5100 and <10800 , Minimum told is 2500.
    For 5100, 5100*50%=2500.
    Test for different values.
    I feel i am clear in explanation.

  6. #6
    Registered User
    Join Date
    07-30-2014
    Location
    Bangladesh
    MS-Off Ver
    MS Office 2007
    Posts
    6

    Re: Nested IF is not working correctly.

    This was? It works. Thank you.

+ 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. Nested IF is not working correctly.
    By nihar sharma in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-20-2014, 06:01 AM
  2. [SOLVED] Nested INDIRECT Command Not Populating Correctly
    By lordfa9 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-17-2014, 11:40 PM
  3. [SOLVED] Simple nested IF statement not working correctly
    By bassemsaad in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-04-2013, 08:53 AM
  4. [SOLVED] Can't get nested Loop to copy range values from 2 tables working correctly
    By gtol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2013, 12:01 PM
  5. Replies: 9
    Last Post: 03-08-2013, 11:50 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