I'm trying to calculate some max/min/ave data based on a certain time criteria constraints. I have multiple samples of data, taken every 5 seconds.
DateTime Value2009-09-10 13:30:00 12009-09-10 13:30:05 2 2009-09-10 30:30:10 3...2009-09-10 13:30:55 42009-09-10 13:31:00 52009-09-10 13:31:05 62009-09-10 13:31:10 7...
9/10/2009 9:30:09 AM
have you tried to reference a cell with those dates in there as opposed to "2009-09-10 13:30:00"so it would look like this:
{=max(if(A2:A30>C1, B2:B30), if(A2:A30<=C2, B2:B30))}
9/10/2009 9:31:52 AM
I have tried that. On another sheet where I'm trying to summarize all the data, I have my two time constraints in two cells, A2=13:30:00 and B2=13:31:00. It spits out the same #VALUEArray equations are kinda finnicky, but gets really crazy if you try to throw in dates. I think it's looking for date serial numbers, but never have been able to figure it out exactly.]
9/10/2009 9:33:41 AM
use =DATEVALUE("2009-09-10 13:30:00")[Edited on September 10, 2009 at 9:36 AM. Reason : my guess is that it's not recognizing the date string as a datetime type]
9/10/2009 9:34:38 AM
Actually, I don't have to have the dates in there, as I can focus just on the time. But I think I'm running into the same issue with the datatypes.
9/10/2009 9:41:46 AM
Convert the time to an integer value=HOUR(C5) + (MINUTE(C5)/60) + (SECOND(C5)/60/60)and use that as your limits
9/10/2009 9:53:39 AM
Thanks Chance. I'll give that a shot.Here's another thought. All of this data is coming out of a large SQL database. Is it possible to have a cell execute a database query (to either a SQL server or an Access database)? I've only seen queries come from VBA, which terrifies me, but it seems like it would be simple to have a cell equation do something like =sqlquery("SELECT MAX(Value) FROM......")Horribly inefficient, but I'm not going for efficiency right now It would save me from having to copy the massive 200,000 row dataset into Excel. ]
9/10/2009 10:08:31 AM
The company that I work for creates a product that allows you to write a sql query and pump the results into an Excel cell, range of cells. PM me if you want to know more.
9/10/2009 10:12:16 AM
http://articles.techrepublic.com.com/5100-10878_11-6112813.htmlExcel has been around long enough that unless you're trying to do something really complex/weird, there should be some info out there to tell you how to do it.Oh, you said sql, then sql and access. Does it have to be sql? I think it can do that to, this from the help page of Office 2007
9/10/2009 12:04:26 PM
^ Thanks for that. I have been trying to avoid diving into the world of VBA, but it looks like it's a must for executing SQL queries. I've successfully avoided it for 10 years Right now all our data is on a SQL server, but I pulled in a subset into an Access DB to see if I could work with it any easier. I also pulled in the same data (250k rows maybe?) into Excel 2007.The work I'm doing now is just for experimentation as I try to develop an algorithm for analyzing and performing operations on the data. Eventually it will be coded into a program by our software folks once I figure out what it is the heck I want to do with the data
9/10/2009 1:58:08 PM
VBA really isn't hard if you have any OO based programming background. First, just record a macro doing random operations to see what it spits out and get an idea of things.From there, just google for what you're trying to do.The biggest thing I struggled (struggle?) with regarding excel VBA is how it handles ranges versus individual cells and setting data.For examplethis is a bit of code I recorded just now
Selection.Copy Range("E10").Select ActiveSheet.Paste
Cells(1, 1).Value = 10
myMax = 0 For myRow = 1 To 10 Step 1 If Cells(myRow, 3).Value > 5 And Cells(myRow, 4).Value > myMax Then myMax = Cells(myRow, 4) End If Next myRowEnd Sub
9/10/2009 2:57:04 PM