COUNTIF will count how many times X occurs in a range of data.
If memory is a problem, try the following:
1. Change your windows background to a blank screen.
2. Close all other programs before opening Excel.
3. Turn off Autocalc
Ways of Consolidating your spreadsheet:
1. Look to see if there are cells that can be combined. For example, look and see if there are multiple logic statements that can be combined into one.
2. Also, a number in a cell takes up less space than an equation. You may see significant space savings if you use a macro to do the logic/calculations and pasting the value in the cells than having the equations in all of the cells.
If possible, see about posting a portion of your spreadsheet & we'll try to see what can be done to modify it.