+ Reply to Thread
Results 1 to 7 of 7

+1 until -1

  1. #1
    Registered User
    Join Date
    09-29-2016
    Location
    london
    MS-Off Ver
    2016
    Posts
    19

    +1 until -1

    Hi

    I would like to create a formula that says if A is above B by 2, then have a +1, if A is below 2, then have a -1.

    However i would also like it to not change in the in between period, so its always -1, until 1 and vice versa.

    Any ideas much appreciated.

    Thanks

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

    Re: +1 until -1

    Example data please
    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,064

    Re: +1 until -1

    "if A is above B by 2"

    Badly worded, but I'm taking this to be IF(A1=B1+2...

    "if A is below 2"

    Based on the above I think you mean IF(B1=A1+2...

    Try this

    Start your data in row 2, NOT row 1

    in C2
    =IF(A2=B2+2,1,IF(B2=A2+2,-1,C1))
    and copy down

    If this doesn't give you what you want then supply some example data with expected output. Check your output before posting.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: +1 until -1

    a
    b
    c
    d
    1
    2
    1
    5
    -1
    c2: =if(a2 >= b2+2, 1, if(a2 <= b2-2, -1, c1))
    3
    5
    6
    -1
    4
    2
    3
    -1
    5
    2
    5
    -1
    6
    2
    4
    -1
    7
    6
    2
    1
    8
    2
    2
    1
    9
    3
    2
    1
    10
    6
    2
    1
    11
    1
    4
    -1
    12
    1
    4
    -1
    13
    3
    6
    -1
    14
    2
    2
    -1
    15
    2
    4
    -1
    16
    5
    2
    1
    17
    4
    1
    1
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    09-29-2016
    Location
    london
    MS-Off Ver
    2016
    Posts
    19

    Re: +1 until -1

    Hi

    I have attached a sheet, the data is updated real time in the two variables, dont know if its possible without a macro or not as the example above assumes there is rows of data nd in my sheet there is not.

    There is just to two cells with changing data.
    Attached Files Attached Files
    Last edited by mcp77; 02-02-2018 at 01:31 PM.

  6. #6
    Registered User
    Join Date
    09-29-2016
    Location
    london
    MS-Off Ver
    2016
    Posts
    19

    Re: +1 until -1

    is anybody able to assist?

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

    Re: +1 until -1

    May be this

    =IF(A4>A3-1,-1,1)
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

+ 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