ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can you formulate a cell to add and subtract in the same cell? (https://www.excelbanter.com/excel-programming/414134-can-you-formulate-cell-add-subtract-same-cell.html)

jmuncy

Can you formulate a cell to add and subtract in the same cell?
 
I have a subtotal and the next cell could be either an addition or a
subtraction from the subtotal. Can you do this with a formula?

Rick Rothstein \(MVP - VB\)[_2325_]

Can you formulate a cell to add and subtract in the same cell?
 
Yes, with an IF function call, but there needs to be some identifiable
"trigger" that chooses one over the other. For example, if your "trigger"
could be cell B1 contains a 0 to select addition and any other value to
select subtraction. Assuming your SubTotal is in A1000, and the value you
want to either add or subtract is in B1000, and the trigger value is in B1
(0 for addition, anything else for subtraction), then this is the formula
you would use is this...

=IF(B1=0,A1000+B1000,A1000-B1000)

Rick


"jmuncy" wrote in message
...
I have a subtotal and the next cell could be either an addition or a
subtraction from the subtotal. Can you do this with a formula?




All times are GMT +1. The time now is 10:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com