Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I am using my Google Spreadsheet to keep tabs of my incoming and outgoing money. I've made a row with ~19 cells in it, in those 19 cells I have the monthly what comes in and what goes out. At the end I add this all up and then subtract a different cell that adds up random costs.

But my problem here is that the calculation =SUM(C4:C17) counts everything, even the money that has not come in or that was spend. But I don't want to fiddle around with that calculation all the time.

Is it possible to make every cell in row C red and when it's red it does not count (so it will be ignored) but if I make the cell green it gets added in the grand total?

share|improve this question

marked as duplicate by Rubén, serenesat, sandwich, jonsca Mar 17 at 22:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
@Rubén That post does not seem to have a useful answer, now that Script Gallery is gone. – sandwich Mar 17 at 20:24
    
@404 Well, maybe it not has a current answer but certainly the questions are the same, aren't they? Regarding the related Q&A the accepted answer has a couple of links that eventually will take the reader to the answer. How should we proceed ? – Rubén Mar 17 at 20:51

You can use the SUMIF() function with some additional (let it be D) column with 0 and 1 values. 1 will mean that the number on the same row counts, and 0 that it does not (the same what you call red).

Next use SUMIF(D4:D17, 1, C4:C17)(SUMIF(range,criteria,sum_range)) to sum only the numbers in the row which have 1 in the additional column D.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.