+ Reply to Thread
Results 1 to 6 of 6

trying to change a cells value to negative based on another cell input

  1. #1
    Registered User
    Join Date
    03-07-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    trying to change a cells value to negative based on another cell input

    I use Excel 2007
    I am trying to change a cell(lets call it C2) to a negative of the number in the cell if another cell (lets call it L2) is changed to "picked up". If the quantity in C2 is already negative then leave it.

    I have a sheet with an ongoing list of equipment coming, being pick up, or moved to another location. More like an event log for an inventory list. I have people forgeting to enter the quantity as a negative when something is picked up/Shipped and it then adds that amount back to the inventory.

    I have set the sheet up to make the cell C2 red when L2 is set to picked up but people are going so fast and we are only human so they still forget.
    Last edited by cjwanat; 03-08-2010 at 05:09 PM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: trying to change a cells value to negative based on another cell input

    You could use a worksheet change event:

    Please Login or Register  to view this content.

    Right click on the sheet tab, select view code and place the above on the resulting code sheet.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    03-07-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: trying to change a cells value to negative based on another cell input

    That works great for row 2 and is just what I asked for.But...

    I did not make myself clear in my first post. I need this to work on all cells in column L and C.

    For Instance if L1 = PICKED UP then I need C1 to be a negative value. If L5 = PICKED UP I would need the value in C5 to be a negative. If L65536 = PICKED UP then I would need C65536 to be a negative value. etc..

    Thanks for your help so far.

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: trying to change a cells value to negative based on another cell input

    Try:

    Please Login or Register  to view this content.
    Dom

  5. #5
    Registered User
    Join Date
    03-07-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: trying to change a cells value to negative based on another cell input

    That works like ordered except for one thing.

    I use a drop down list in column L and a couple of times in my testing I selected PICKED UP as an error. When I selected one of the other options in the drop down menu the negative stayed applied to the C cell.

    Is there a way to set the C cell value back to Positive if anything but PICKED UP is selected?

  6. #6
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: trying to change a cells value to negative based on another cell input

    Here you go...

    Please Login or Register  to view this content.
    Dom
    Last edited by Domski; 03-08-2010 at 04:39 PM. Reason: Slightly better code

+ 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