Best Microsoft Excel Bloggers

Tuesday, June 15, 2010

SUMIF

SumIf is a great function that a lot of people don’t know up about. Basically it combines two very popular functions -the SUM function and the IF Function. SumIf tests specified cells and if those cells meet certain conditions or “criteria” the selected cells are then summed up.


Think of the possibilities: You may wish to sum up receipts by different lockboxes or sum up the value of past-due invoices. Or you may just want to add up negative numbers in a column quickly or add up the returns or overtime for a particular day.

I am using a very simple example to illustrate SumIf. In the example below, I tested to see if any of the house prices in cells A3: A6 exceeded 150,000 so that I could sum the related realtor commissions. In looking at the example, you can see that there are two houses that meet this criterion (at row 4 and 5) and that the corresponding realtor commissions are in Column B.

The house prices at row 4 and 5 met the specified criteria so the corresponding values in Column B, (12,500 and 10,000) were added up to calculate total commissions on houses with prices over $150,000.


So, basically, the IF component checked to see if any houses were over $150,000 and then the SUM component added up the corresponding realtor commissions associated with those houses in Column A.


Two notes of caution of a SUMIF.

*Notice that I started my range at A3 instead of A2.It is important to remember not to include your column headings as part of the data range when you select your data as this may result in an incorrect answer. If you have a terrible memory and don’t like to fuss around then select the entire column by clicking on the column letter so that you don’t have to worry about it.

*If you use IFs frequently, you may have already noticed the quotation marks around the criteria. SumIF is not considered a logic function. It is considered a Math and Trig function so the syntax is a bit different and quotation marks are needed if you type the criteria in as I did.

Excel is usually forgiving and will automatically insert them if you forget. If the criterion used is a cell reference, such as B12, then you would not need to use the quotation marks; however, the contents of the cell would need to include the operator if there was one.

An alternative way to use SUMIF  if shown below.  This is an example of a rollup. I have personnel data and I want to add up salaries IF they meet the shift criteria that I have in cell G2.


 Here I have told Excel to add up all the salaries in Column F if the Shift information in Column E meets the criteria specified in cell G2. In this case, I want to add up all the salaries for everyone on Shift 1.

(To make it even more useful, use a data validation list in cell G2 containing the different shift numbers).

No comments:

Post a Comment


Ms. Excel- Resident Excel Geek