+ Reply to Thread
Results 1 to 5 of 5

Complex 'IF' scenario

  1. #1
    Registered User
    Join Date
    12-14-2015
    Location
    Hong Kong
    MS-Off Ver
    2007
    Posts
    3

    Complex 'IF' scenario

    Hi Admin,

    I need to do a percentage variance this year vs last year. However, there is a very complex requirement which I cannot complete it purely using 'IF' function. The comparison is on an expense which can be positive and negative by nature. Assuming last year number is 100, current year number is 150. Here are the scenario:
    1. C/L: If c =0, then show 'N'A
    2. C/L: If c = +ve, L = -ve, the ratio = (C-L)/-L = (150-(-100))/-(-100) = 250%. Negative -100 --> 150 = improve 250%
    3. C/L: If c = +ve, L = +ve, the ratio = (C/L)-1 = 150/100-1 = 50%
    4. C/L: If c = -ve, L = +ve, the ratio = ((C-L)/L) = (-150-100)/100 = -250%. Similar reason as #2
    5. C/L: If c = -ve, L = -ve:
    a. C -ve > L -ve (C is more negative), the ratio = -((C/L)-1) = -((-150/-100)-1) = -50%. Even though both are negative, but this year nagative is bigger and thus the ration should be negative
    b. C- ve < L -ve (L is more negative), the ration = -C/L+1 = -(-99/-100)+1= 1%This year is showing improvement vs last year even though this year is negative
    6. Everything is the same as 2 - 5 except if the ration is exceeding +200% or -200%, it should show '++' or '- -'.

    So in general, we would like to show a meaningfull ration for 2 year figures on the monthly management report. Is there anyway to do it properly??

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

    Re: Complex 'IF' scenario

    What happens if L=0 ?
    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.

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

    Re: Complex 'IF' scenario

    For 2 to 5
    Try

    IF(C=0,"NA",IF(SIGN(C)*(SIGN(L)=-1,(C-L)/L*SIGN(L),IF(SIGN(C)>0,C/L-1,-(C/L-(C<L)+(L<C)))))

  4. #4
    Registered User
    Join Date
    12-14-2015
    Location
    Hong Kong
    MS-Off Ver
    2007
    Posts
    3

    Talking Re: Complex 'IF' scenario

    Thanks Special-K. I learned a new thing from you using 'Sign' command. However, I don't quite understand the meaning of this portion of the formula '-(C/L-(C<L)+(L<C))'. There is no need to use 'IF' function in this formula but it can still do the calculation based on condition?
    Anyway, thanks for your help.

  5. #5
    Registered User
    Join Date
    12-14-2015
    Location
    Hong Kong
    MS-Off Ver
    2007
    Posts
    3

    Re: Complex 'IF' scenario

    In addition, as I don't want to show crazy 9999999% in the ratio, how can I show something meaningful if the ratio exceeds a ratio say 300%?

+ 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. Replies: 4
    Last Post: 02-03-2014, 12:47 AM
  2. [SOLVED] Need help with a What If Scenario
    By icevinson in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-12-2013, 02:08 PM
  3. Mail Merge : All-in-1 Page with Complex Scenario
    By donkeybusiness in forum Word Formatting & General
    Replies: 4
    Last Post: 01-30-2013, 03:06 AM
  4. Scenario Manager displays same result for every scenario
    By terihoff in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 11-10-2012, 07:14 PM
  5. Replies: 0
    Last Post: 08-16-2012, 01:32 PM
  6. What If Scenario
    By wackyrich in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-09-2009, 08:48 PM
  7. Scenario
    By punkiegirl420 in forum Excel General
    Replies: 5
    Last Post: 11-05-2006, 05:26 PM
  8. [SOLVED] Complex Index Match Help (or at least complex to me)
    By Jennifer Reitman in forum Excel General
    Replies: 3
    Last Post: 08-10-2006, 03:55 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