Google Sheets – Reverse Subtraction if Less Than Zero

formulasgoogle sheetsgoogle-sheets-arrayformula

I have a simple Google spreadsheet that Takes the estimated cost for a service provided and compares it to the actual cost of the service. the equation I have in the Q column is =K4-P4. When the estimated cost (column K) is less than the Actual cost (column P) I need a positive number in Column Q. And I need the reverse of that if K is greater than p. I'm new to spreadsheets and would appreciate any help.

enter image description here

Best Answer

=ARRAYFORMULA(IF(LEN(K4:K&P4:P), IF(K4:K-P4:P<0, P4:P-K4:K, K4:K-P4:P), ))

0