+ Reply to Thread
Results 1 to 4 of 4

Displaying -1,0 or 1 depending on cell value?

  1. #1
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Displaying -1,0 or 1 depending on cell value?

    Hi all,

    Im trying to get a cell to display either 1, 0 or -1 depending on other cells product here's what i'm using =IF(E5=0,0,IF(OR(B$5-E5<0,B$5-E5>4),0,VLOOKUP(B$5-E5,{-1,1;-2,1;-3,1;1,-1;2,-1;3,-1},2))) i can get itto display 0 or -1 or 0 and 1, my criteria is this if E5 > B5 by any amount then display -1 if E5 = B5 then display 0 and if E5<B5 by any amount display 1.

    I cant seem to manage it with the formula above, any ideas?

    Regards,
    Simon

  2. #2
    Tom Ogilvy
    Guest

    Re: Displaying -1,0 or 1 depending on cell value?

    =sign(B5-E5)

    --
    Regards,
    Tom Ogilvy

    "Simon Lloyd" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Hi all,
    >
    > Im trying to get a cell to display either 1, 0 or -1 depending on other
    > cells product here's what i'm using
    >

    =IF(E5=0,0,IF(OR(B$5-E5<0,B$5-E5>4),0,VLOOKUP(B$5-E5,{-1,1;-2,1;-3,1;1,-1;2,
    -1;3,-1},2)))
    > i can get itto display 0 or -1 or 0 and 1, my criteria is this if E5 >
    > B5 by any amount then display -1 if E5 = B5 then display 0 and if E5<B5
    > by any amount display 1.
    >
    > I cant seem to manage it with the formula above, any ideas?
    >
    > Regards,
    > Simon
    >
    >
    > --
    > Simon Lloyd
    > ------------------------------------------------------------------------
    > Simon Lloyd's Profile:

    http://www.excelforum.com/member.php...fo&userid=6708
    > View this thread: http://www.excelforum.com/showthread...hreadid=546345
    >




  3. #3
    JE McGimpsey
    Guest

    Re: Displaying -1,0 or 1 depending on cell value?

    One way:

    =SIGN(B5-E5)

    In article <[email protected]>,
    Simon Lloyd <[email protected]>
    wrote:

    > my criteria is this if E5 > B5 by any amount then display -1 if E5 =
    > B5 then display 0 and if E5<B5 by any amount display 1.
    >
    > I cant seem to manage it with the formula above, any ideas?
    >
    > Regards,
    > Simon


  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    JE & Tom, Thanks!!!! i can't believe it was that simple, i was looking at a very long winded complicated way.....you know...sledge hammer to crack a nut!

    Cheers!
    Simon

+ 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