Google-sheets – Calculate difference between numbers in 2 columns row-by-row in a spreadsheet

google sheetsworksheet-function

I have 3 columns in a Google Docs spreadsheet: A) Inventory purchased price, B) Inventory sold price, C) Difference between A and B (i.e. profit or loss)

Data is going to be entered manually into columns A and B. How do I make column C to 1) display the calculated amount for each row, and 2) color profitable sales in green and unprofitable in red?

Best Answer

.. and for the first question, assuming your data start in row 2, in C2 try:

=ArrayFormula(if(len(A2:A)*len(B2:B), B2:B-A2:A,))

This formula should automaticcaly output the difference between B and A when data is entered. See if that works ?