+ Reply to Thread
Results 1 to 6 of 6

Summing numbers

  1. #1
    Registered User
    Join Date
    07-04-2011
    Location
    new york
    MS-Off Ver
    Excel 2003
    Posts
    8

    Summing numbers

    Hi There

    I was wondering if there is a way to have a currency number be positive or negative based on a another cell?

    for example

    sumif = "expenses" then the number displays as negitive (-1000)

    sumif = "income then number would display as positive (1000) with out the nimus?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Summing numbers

    Sure. Do you mean there is a cell with a string that says either "income" or "expense"? Let's say that string is in A1. You have a bunch of numbers that you are summing in A2:A100.

    =IF(A1="expense",-1,1)*SUM(A2:A100)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    07-04-2011
    Location
    new york
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Summing numbers

    its a bit more complicated then that. can you take a look at the excel sheet and see the highlighted areas? i basically want that when i type in "expense that when i type in any digit in the amount it automatically makes it negative and when i chose "income" that when i type in the amount it shows positive
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Summing numbers

    Because your dollar amounts are just typed in, there two ways to do this. One is to have one column where you enter the data (say P), and column F will contain a formula like the one I provided that refers to the data you entered.

    =IF(C2="Expense",-1,1)*P2

    The other way that is more elegant is with a macro that detects any time you change a value in column C or F, and then it updates the sign of the number in column F accordingly. I have attached that solution.

    Keep in mind that this macro is specific to a worksheet, and it looks like you're going to add a new worksheet for each month. Therefore this macro has to be copied to each new worksheet.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-04-2011
    Location
    new york
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Summing numbers

    Im sorry to bother you again, can you show me in a sheet how its done? i dont quite get it and the one you attached doesn't have the formula in it many thanks

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Summing numbers

    The one I attached has a macro in it. When you select Income or Expense in column C, the number in column F is automatically updated to be positive or negative. If this does not work for you then you probably have your security settings so high that macros will not run.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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