+ Reply to Thread
Results 1 to 8 of 8

Changing number to negative based on another cell value

  1. #1
    Registered User
    Join Date
    07-01-2006
    Posts
    40

    Changing number to negative based on another cell value

    Could anyone help me write this VBA...

    I have numbers (all positive) in column D and either "debit" or "credit" in column E
    I'd like to turn the positive number into negative if its corresponding row E column cell states "debit".
    If it says "credit" in E, the number would be left unchanged, ie. positive.

    Thanks so much

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Changing number to negative based on another cell value

    Either one will work. Just depends on how you want to implement it:

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Changing number to negative based on another cell value

    Try...

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  4. #4
    Registered User
    Join Date
    07-01-2006
    Posts
    40

    Re: Changing number to negative based on another cell value

    thanks, it worked

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Changing number to negative based on another cell value

    You're welcome…glad you have a workable solution and thanks for the feedback...

    NOTE: Just so we know, what worked for you...

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Registered User
    Join Date
    07-01-2006
    Posts
    40

    Re: Changing number to negative based on another cell value

    One followup...

    I'm using :
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If occasionally, I end up with a value in E that's neither debit or credit, how do I state a Case that would accept "anything else" as value?

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Changing number to negative based on another cell value

    Use Case Else

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-01-2006
    Posts
    40

    Re: Changing number to negative based on another cell value

    Thank you, that's the one

+ 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: 1
    Last Post: 05-09-2013, 08:11 PM
  2. making a number positive or negative based on a word in another cell?
    By dbwoods11 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-09-2013, 04:19 AM
  3. Problem with changing cell from Negative number based on User Form
    By seanain in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-17-2012, 08:30 PM
  4. Replies: 4
    Last Post: 03-22-2012, 12:05 AM
  5. Changing a Positive Number to a Negative Automatically
    By Follychops in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-26-2011, 02:56 AM

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