+ Reply to Thread
Results 1 to 9 of 9

formula to allow only negatives

  1. #1
    Registered User
    Join Date
    02-02-2007
    Posts
    4

    Smile formula to allow only negatives

    Hi,

    Can someone help me on a formula query.

    I want to force a cell to only allow negative values and convert any enter value to negative. In one cell (A1) there's a drop down for either Add or Remove and the next cell (B1) the values are added, if cell (A1) = 'Remove' then the value of (B1) must be negative or convert value to negative.

    I hope I'm being clear, thanks for any help.

    Mike

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    You can use an "helper" cell

    =IF(A1="Remove",B1*-1,B1)
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    02-02-2007
    Posts
    4

    Smile

    It works great, thanks for your help.

    Mike

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Glad to hear it - thanks for the feedback

  5. #5
    Registered User
    Join Date
    02-02-2007
    Posts
    4
    Hi oldchippy,

    I've just notice a small problem on using this =IF(A1="Remove",B1*-1,B1), if someone remembers to put in a negative value as its a removal (they usually forget) it will convert the value back to a positive.

    And it all seemed so simple.

    Mike

  6. #6
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    The alternative would be to put Data Validation on the cell they enter their figures so that it doesn't allow negative numbers

  7. #7
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Try this:

    =IF(AND(A1="Remove",B1>0),B1*-1,B1)

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829
    Alternatively
    If(A1="remove",-ABS(B1),ABS(B1))

  9. #9
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    =IF(A1="remove",SIGN(B1)*B1,B1) is an alternative.

    Why not put Validation on B1?

+ 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