Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Sums in Excel

Status
Not open for further replies.

DickiePotter

Programmer
Jan 8, 2001
30
0
0
GB
I am trying to create a cell which holds the sum of several other cells. The problem is, I don’t want all the cells included. I need Excel to search all the cells in one column to find a keyword, if it finds the keyword I need the figure on that row (in another cell) to be included in the sum.
Please help!
 
Say the data you wish to sum is in column B, and the keywords are contained in column A. Assume the keyword is "Total". Enter the following into a cell :

=SUM(($A$2:$A$999="Total")*$B$2:$B$999)

Before you finish, enter the formula with Ctrl+Shift+Enter. Now the formula will look like this :

{=SUM(($A$2:$A$999="Total")*$B$2:$B$999)}

A more detail explaination of conditional sums can be found within the FAQ section under Best of Excel.

 
Excel has a built in function which can do this for you which is called SumIF.

The SUM IF function works by adding up entries which meet criteria you specify. Let's say that you have a column of names in column B and their hours worked in column C and you only want to SUM the hours for one name - let's say Gurnerworld.

If you create a formula like this:

=SUMIF(B2:B999,"Gurnerworld",C2:C999)

It will look in column B for all entries which contain Gurnerworld and then add up all corresponding entries in Column C.

I hope this helps.

Gurnerworld.
BrainBench MVP for MS Excel
Check out my software tips site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top