Solved

Adding only records that meet a criteria

Posted on 2011-09-21
4
166 Views
Last Modified: 2012-05-12
Hello:

I have a spreadsheet with several columns in it.  The values that I want to add are in the columns.  I only want to add the columns where the heading for that column is "add".

Of course I can just choose those cells, but I am looking for a formula that will only add the values when the heading(or cell above them say "add")

I am attaching a small example.

Thank you! exampleofadd.xlsx
0
Comment
Question by:MeowserM
  • 2
  • 2
4 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 36574254
Try using SUMIF function, i.e. this formula

=SUMIF(B$2:J$2,"add",B3:J3)

regards, barry
0
 

Author Comment

by:MeowserM
ID: 36574448
awesome - can I use this with countif too?
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
ID: 36574603
To count what? You can count the number of "add"s in a range, e.g.

=COUNTIF(B$2:J$2,"add")

....but if you want to count how many numbers in your range are in the "add" columns but also meet another criterion, e.g. larger than 5 then you can use COUNTIFS (with an "S") like this

=COUNTIFS(B$2:J$2,"add",B3:J3,">5")

regards, barry


0
 

Author Comment

by:MeowserM
ID: 36575001
That's perfect - Thank you Barry!!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now