You are here:

# Excel/using sumif statement

Question
I would like sum data by hour. Thanks you very much!

2/4/13 13:19   0
2/4/13 13:34   2
2/4/13 13:49   0
2/4/13 14:04   0
2/4/13 14:19   14
2/4/13 14:34   18
2/4/13 14:49   0
2/4/13 15:04   34
2/4/13 15:19   0
2/4/13 15:34   38
2/4/13 15:46   2
2/4/13 15:50   0
2/4/13 16:03   0
2/4/13 16:14   0

2/4/13 13:00    total
2/4/13 14:00    total
...

Grace -

Because you are searching for a time range (i.e. 13:00 through 13:59), you will need to use the SUMIFS() function. It allows you to search for multiple criteria.

=SUMIFS(SUM_RANGE,CRITERIA_RANGE1,CRITERIA1,CRITERIA_RANGE2,CRITERIA2...)

SUM_RANGE are the cells that contain the data that should be added, in the case of your sample that would be column C.
CRITERIA_RANGE1 is the cells that contain the hours. In this case, column B.
CRITERIA1 is where we begin the hourly range. Since we're trying to get anything within the 1 o'clock hour, we choose something that means "1:00 or anything after" -- ">=13:00"

If we leave it at this criteria, we'll get everything from 1:00 on. We need to put an end on the range.
CRITERIA_RANGE2 is the same as CRITERIA_RANGE1
CRITERIA2 should be for "anything before 2:00" -- "<=13:59"

The complete function for the 1 o'clock hour is:
=SUMIFS(C1:C10,B1:B10,">=13:00",C1:C10,B1:B10,"<=13:59")

Just change the time in the function to get the other hours totals. Hope this helps - Andrea
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Andrea Lynch

##### Expertise

I am very familiar with teaching excel concepts, and formulas. I am not as capable with VBA questions.

##### Experience

I currently tutor in this area. I worked for four years developing curriculum and teaching Microsoft applications to adult audiences. I also previously volunteered for allexperts.com.

Education/Credentials
BA, English, Western Washington University Certificates in C Programming, ASP.NET, VisualBasic.NET, University of Washington Extension

Awards and Honors
Rated in the top ten instructors (national), New Horizons Computer Learning Center.