Forum Discussion
ChristopheMoro2070
Jan 27, 2023Copper Contributor
Negative number change
Hi,
1-1-2023 | NL89TRIO0254663206 | 107,35 | Debet | KN | Kosten van 01-10-2022 tot en met 31-12-2022 | ||
1-1-2023 | NL89TRIO0254663206 | 6.500,00 | Credit | A.P.C.van Tetering eo A.C.J.van Tet | RABONL2U NL26RABO0159903408 | ET | No. 016868-001 Maroko reis 5 personen |
if Colom D has text Debet, I would have change colom C to a negative number
Thanks
C
- PeterBartholomew1Silver Contributor
Spreadsheets are a type of functional programming environment and formulas are prevented from making state changes of the type you describe. What you want could be achieved by a VBA (imperative programming) call that does use state changes.
Unless you want to use VBA event handlers, I suggest you leave the amount cell as it is and only introduce the 'debit' when you reference the data. You could, for example, introduce a named formula
signedAmount = IF(Type="Credit", Amount, -Amount)
Then you might have other spreadsheet formulas such as
= SUM(signedAmount) = IF( signedAmount>0, 20% * signedAmount, 0 )