+ Reply to Thread
Results 1 to 7 of 7

Simplifying Nested IF Functions

  1. #1
    Registered User
    Join Date
    07-09-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    2

    Simplifying Nested IF Functions

    Dear Excel Connoisseurs,

    My apologies if this has already been asked, but I have an IF function that look like this:

    =
    IF(MOD(96*0+C4,B4)=0,(96*0+C4)/B4+1,
    IF(MOD(96*1+C4,B4)=0,(96*1+C4)/B4+1,
    IF(MOD(96*2+C4,B4)=0,(96*2+C4)/B4+1,
    IF(MOD(96*3+C4,B4)=0,(96*3+C4)/B4+1,
    IF(MOD(96*4+C4,B4)=0,(96*4+C4)/B4+1,
    IF(MOD(96*5+C4,B4)=0,(96*5+C4)/B4+1,
    IF(MOD(96*6+C4,B4)=0,(96*6+C4)/B4+1,
    IF(MOD(96*7+C4,B4)=0,(96*7+C4)/B4+1,
    IF(MOD(96*8+C4,B4)=0,(96*8+C4)/B4+1,
    IF(MOD(96*9+C4,B4)=0,(96*9+C4)/B4+1,
    IF(MOD(96*10+C4,B4)=0,(96*10+C4)/B4+1,
    0)))))))))))

    I want the value that 96 is being multiplied by to keep increasing by one indefinitely, both in the Logical Test part of the function and the If True part.

    Can the function be simplified to utitilize infinity symbols or ranges?

    My thanks in advance.
    Last edited by jason01; 07-09-2010 at 01:30 PM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Nested IF Functions & My Desire to Simplify Them

    What are you actually trying to achieve?

    What are the values you are evaluating and what is the expected result?

    Might be better to post a sample workbook giving some examples.

  3. #3
    Registered User
    Join Date
    07-09-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Nested IF Functions & My Desire to Simplify Them

    Marcol,

    Your questions are actually difficult for me to answer (a sample workbook would be unintelligible).

    I can say that if B4 = 5 and C4 = 3, then the answer given by the function (as adumbrated in my initial post) will be 40, which is the desired result. However, if B4 = 29 and C4 = 3, the answer is 0, which is undesired.

    Basically, I want to be able to enter any poisitive number into B4 and still have the function work (never give a 0). Thanks.
    Last edited by jason01; 07-09-2010 at 02:57 PM.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Simplifying Nested IF Functions

    .........if B4 = 29 and C4 = 3, the answer is 0, which is undesired.
    Should the desired answer be 64 in this case?

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Simplifying Nested IF Functions

    Hi jason01
    you can use an interation with circular reference

    but what are you trying to do find the first divisor ?
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,726

    Re: Simplifying Nested IF Functions

    You could use an array formula like this

    =(MATCH(0,MOD(96*ROW(INDIRECT("1:10000"))+C4,B4),0)*96+C4)/B4+1

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Simplifying Nested IF Functions

    I have doubts that this can be completely solved.

    Have a look at the attached sheet, it is not intended to be a solution to your problem, I am only trying to clarify what you are trying to achieve.

    I have used conditional formatting to highlight possible answers
    Yellow = Your formula result
    Red = Condition to evaluate
    Orange = possible solutions

    The table is large because some conditions need large itterations.

    Looks to me like solution is found by stepping down column E until 0 is met, then go right until the first integer is found.

    This would possibly be done with code, or as Pike suggests itterating circular refs.
    Perhaps the Solver Add-in has an answer.

    What happens when no solution is found, and how many itterations need be tried before it is accepted that a solution is improbable?

    If I am missing something please let us know.

    [EDIT]
    daddylonglegs' solution is excellent!
    I have added it to the Demo Workbook to show some of the possible inconsistancies
    Attached Files Attached Files
    Last edited by Marcol; 07-10-2010 at 10:23 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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