How to make an Excel formula which totals several adjacent rows based on cell values


I have an Excel sheet with three columns: date, person and percentage. I would like to put in a data validation that flags cells if the total for a given data/person combination do not equal 100%. Is that possible?

In other words, in the custom formula of a data validation, I would like to make the following type of formula.

 =if(sum( cells with a (date = the date on this row, person = person on this row))=1)

Is there a function which will return the cells in a range conditioned on certain values, or will sum the cells.

Note that if it is not possible to do two cells, I have no issue adding a cell which combines both values for the purpose of affecting the lookup.

Best Answer

You want SUMIF (for a single criteria), the Microsoft SUMIF page on it, is pretty good. as is the OfficeArticle's SUMIF.

Or just SUM with an array function (see above article from officearticles) for multiple criteria. For instance in the sheet below I entered the formula without curly braces into G2, and helt Ctrl+Shift+Enter, then I drug the formula down.

an excel array formula

If you have many many rows, then you'll need to move on to using DSUM for speed reasons. As you noted in your comment, they have to have their own little faux-table somewhere.

Really it sounds like you're quickly moving past what Excel can do without busting into VBA. A database, or targeted application may be in your near future.

edit: added information on array formula, pretty picture