Trying to sum data that fits certain criteria

jc77

New Member
Joined
Feb 17, 2012
Messages
6
I can't seem to figure this out.

I'm trying to sum data that fits w/in two dates I've specified. Normally, this would be a simple sumif formula. But the data I'm actually summing has text string and so Excel doesn't see the numerical values to be able to add them.

Here's what my data table looks like.

Task / Duration Hrs / Start Date
A / 3 hrs / 2/1/12 08:00
B / 6 hrs / 2/6/12 16:00

I want to sum the total duration hrs for all tasks that start sometime between "Feb 1 0:00" and "Feb 29 23:59" so I want Excel to return the value "9" in this example. I know how to use LEFT LEN to return duration hours values if I was evaluating each cell individually but not sure how to combine if w/ the sumif formula if I want to analyze an entire worksheet of data.

Should I be using another formula? Thank you very much for your help.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
maybe this way.
Excel Workbook
ABCDEFGH
1data => text to collumn
2TaskDurationHrsStartDateyearmonthday
3A3hrs1-2-20128:00201221
4B6hrs6-2-201216:00201226
5
6
79
Blad6
Cell Formulas
RangeFormula
F3=YEAR(D3)
F4=YEAR(D4)
G3=MONTH(D3)
G4=MONTH(D4)
H3=DAY(D3)
H4=DAY(D4)
B7=SUMPRODUCT((G3:G4=2)*(B3:B4))
 
Upvote 0
I can't seem to figure this out.

I'm trying to sum data that fits w/in two dates I've specified. Normally, this would be a simple sumif formula. But the data I'm actually summing has text string and so Excel doesn't see the numerical values to be able to add them.

Here's what my data table looks like.

Task / Duration Hrs / Start Date
A / 3 hrs / 2/1/12 08:00
B / 6 hrs / 2/6/12 16:00

I want to sum the total duration hrs for all tasks that start sometime between "Feb 1 0:00" and "Feb 29 23:59" so I want Excel to return the value "9" in this example. I know how to use LEFT LEN to return duration hours values if I was evaluating each cell individually but not sure how to combine if w/ the sumif formula if I want to analyze an entire worksheet of data.

Should I be using another formula? Thank you very much for your help.
It looks like your time range is for the entire month of Feb 2012. Are all the dates within the same year?
 
Upvote 0
Oeldere:
Unfortunately, my data is a copy/paste from MS Project so I really can't reorganize the columns and the data. I'm trying to automate this process so that I can analyze a schedule that may have several hundred tasks.

I already am using sumproduct to calculate the number of tasks that fit w/in a certain month. But now, I actually need to sum the duration hrs associated w/ those tasks.

Thank you for your help.


T. Valko:
My example only included Feb for simpler explanation. In actuality, the tasks can be any time in the 2012 and 2013. My true goal is to total the task duration hrs in each month. I'm using the start date as my condition.

Thank you for your help.
 
Upvote 0
Code:
I already am using sumproduct to calculate the number of tasks that fit w/in a certain month. But now, I actually need to sum the duration hrs associated w/ those tasks.

Please, show us your formula, maybe it gives new ideas.
 
Upvote 0
Oeldere:
Unfortunately, my data is a copy/paste from MS Project so I really can't reorganize the columns and the data. I'm trying to automate this process so that I can analyze a schedule that may have several hundred tasks.

I already am using sumproduct to calculate the number of tasks that fit w/in a certain month. But now, I actually need to sum the duration hrs associated w/ those tasks.

Thank you for your help.


T. Valko:
My example only included Feb for simpler explanation. In actuality, the tasks can be any time in the 2012 and 2013. My true goal is to total the task duration hrs in each month. I'm using the start date as my condition.

Thank you for your help.
What version of Excel are you using?
 
Upvote 0
Here's what I'm using right now.

=SUMIFS(B37:B38,C37:C38,"<=2/29/12 23:59",C37:C38,">=2/1/12 0:00")

B37:B38 is the column of task duration hours
C37:C38 is the column of tasks start dates

This works if Column B is nothing but numerical values. In my case, however, I have a number followed by "_hrs"

I tried to embed: (LEFT(B37:38,LEN(B37:38)-4))

in the place of B37:38 in the above sumif formula but Excel didn't like that.
 
Upvote 0
I'm using Excel 2007
Try this...

Book1
ABCDEF
1TaskDuration HrsStart Date_MonthTotal
2A3 hrs2/1/2012 8:00_2/1/201218.5
3B6 hrs2/6/2012 16:00___
4C10 hrs1/1/2012 14:15___
5D2.5 hrs2/28/2012 10:25___
6E2 hrs1/31/2012 23:35___
7F2 hrs3/1/2012 0:15___
8G7 hrs2/29/2012 23:59___
9H1 hr2/10/2013 1:20___
Sheet1

This array formula** entered in F2:

=SUM(IF(TEXT(C2:C9,"mmmyy")=TEXT(E2,"mmmyy"),--LEFT(B2:B9,FIND(" ",B2:B9))))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
 
Upvote 0
Code:
Unfortunately, my data is a copy/paste from MS Project so I really can't reorganize the columns and the data

If you want to calculate a lot in this workbook I advise you to reconsider the format of the workbook.;)
 
Upvote 0

Forum statistics

Threads
1,223,101
Messages
6,170,116
Members
452,302
Latest member
TaMere

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top