title: Count cells by their color in Excel
body: <p>This question is simple: How can I update a total number count in Excel that decreases based on how many red X's there are in a given column.</p>
  
  <p>Where this becomes too complicated for me: I have made macros to sort cells based on numbers or color. There are five different colors, each representing a different county in my area. I have a total for each county. (ex. yellow = 41, blue = 15, red...) and want to update each colors total respectively (by subtracting 1 for each X) IF there is an X in the completed column. </p>
  
  <p>So issues:</p>
  
  <ul>
  <li>How to keep track of a row of cells, though they may be sorted three
  different ways at any given time (Is there a permanent cell ID?). </li>
  <li>How to update a number count for just a certain range of cells of the
  same color.</li>
  </ul>
  
  <hr>
  
  <p>Attached is a picture of the top of the spreadsheet to better understand how this looks: </p>
  
  <p><img src="https://i.stack.imgur.com/9sIfk.png" alt="spreadsheet"></p>
  
  <p>any help is greatly appreciated, my unfamiliarity with excel functions is probably the root cause of this problem.</p>