+ Reply to Thread
Results 1 to 35 of 35

Average Formatting

  1. #1
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Average Formatting

    I have data over a range of three days. The date and time at minute intervals is in one column, and the data at each of those intervals is in another. How can I create a forumla that will say something like: "if the time is 7:00:00 am on any of these three days, sum the value of the corresponding data". And allow this to occur every minute, so there is a similar one for "if the time is 7:01:00..." There are 3 data points for each minute interval - one representing that time at each day.

    Anyone know how to do this?
    Last edited by seanyc; 06-18-2012 at 01:58 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Formatting

    seanyc,

    Can you please close off your open threads.. as you are leaving us hanging on those threads. If you don't close them off and respect the people's time and effort to help you, you will find less people willing to help in the future.

    Also, If I remember correctly you are using non contiguous ranges.. please specify and also post a sample workbook so people can more accurately help.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Conditional Formatting

    Ok will do. Sorry about that.

  4. #4
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Conditional Formatting

    volume_example.xls

    Here it is. Thank you very much.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Formatting

    In D4:

    =SUMPRODUCT(--(MOD($A$4:$A$1848,1)=MOD(A4,1)),$B$4:$B$1848)

    copied down

  6. #6
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Conditional Formatting

    Thank you. I'm trying to understand what this is showing me. It is the volume over the three days at the specific time? So for example in D4 when i input that equation, I am getting the average volume for 7:00 am on each of the three days?

    Thank you so much for helping me

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Formatting

    You asked for the sum... so it's giving the sum of all the cells in column B that have a corresponding time in column A of 7:00 AM.

    If you want average:

    =SUMPRODUCT(--(MOD($A$4:$A$1848,1)=MOD(A4,1)),$B$4:$B$1848)/SUMPRODUCT(--(MOD($A$4:$A$1848,1)=MOD(A4,1)))

  8. #8
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Conditional Formatting

    Ok cool. So for example, when I input that formula into D4 my output is 9. Does that mean that the average volume for every data in that range with the time "7:00" is 9? There is only volume data for 7:00 on the 13th, which is 20. So should the average not be 20?

    Is there anyway to reflect the average at each seperate data interval - perhaps every 5 minutes to make it easier. So for every time at 7:00 on each of the three days within the range (13th, 14th, 15th) it shows the aggregated average of that data at 7:00, then at 7:05, and so on?

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Formatting

    I see 7:00 AM entries in cells:

    B4: 20
    B731: 6
    B1347: 1

    which adds up to 27... so average is 27/3=9

  10. #10
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Conditional Formatting

    Ok awesome sorry I was reading that wrong.

    Now that I have that, is there anyway to space it out over 5 minute intervals? So to be able to say, from 7:00 - 7:05 the average aggregated volume is this?

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Formatting

    Try:

    Please Login or Register  to view this content.
    btw: this does not have to do with Conditional formatting as per your sample.. can you update your title appropriate to the actual problem.?

  12. #12
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Conditional Formatting

    Sure, how do I do that?

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Formatting

    Edit your first post... click Go Advanced.. fix the title.

  14. #14
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    Thank you very much. What if I were to split the data up by days so I could get a running aggregate per day, and then I wanted to use the same formula but across different formula to represent different days.

    I'll attach an example below, but I want to do the same thing we did before and get the average data value at the same time point for each of the three days.
    Attached Files Attached Files

  15. #15
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    That is what I had assumed you had at the beginning...

    Also, If I remember correctly you are using non contiguous ranges.. please specify and also post a sample workbook so people can more accurately help.
    why are we going back to this now!

  16. #16
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    I'm sorry, I am very new to excel and keep getting different demands from a client. I apologize for being a pain. Could you still help with this?

  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    Did we not work on that the other day? I mean getting average over the 3 days on a minute-by-minute basis, with this setup? What is the difference here?

  18. #18
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    Im not sure. I'd imagine it'd be something similar to =SUMPRODUCT(--(MOD($A$4:$A$1848,1)=MOD(A4,1)),$B$4:$B$1848)/SUMPRODUCT(--(MOD($A$4:$A$1848,1)=MOD(A4,1))) but with the ranges split across multiple columns? I am not sure how to do that however.

  19. #19
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    If you enter the first time in O2 (e.g 7:00 AM), then try:

    =SUMPRODUCT(--(ROUND(MOD($A$4:$K$1848,1),6)=ROUND(O4,6)),$B$4:$L$1848)/SUMPRODUCT(--(ROUND(MOD($A$4:$K$1848,1),6)=ROUND(O4,6)))

    I added the ROUND() function to ensure matches as when times are manually entered and you are comparing to date/time entries, Excel will not match them accurately because of precision issues... so the Rounding makes sure to shorten the serial time to more compatible values...

  20. #20
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    I played =time(7,00,00) into O2 and I am getting a circular reference error and an output of 0 when I place the formula in D4. Am I doing something wrong?

  21. #21
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    I'm trying to get it basses off the aggregated volumes in d4, h4, and m4. Sorry for double posting. I want to thank you so much for helping me, it really means a lot.

  22. #22
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    The formula needs to be outside of the A4:M1848 range... put it in P4 copied down.

    Note: It is probably easier to put 7:00 in O2, 7:01 in O3, then select both and fill down to automatically add 1 minute intervals.

  23. #23
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    It seems like the outputs in P4 and down are just the regular volume at the corresponding cells. I'll attach what I have. I'm trying to get the average of the aggregate volumes at each time across the different days. So that is columns C, G, and K.

    I owe you big thank you.
    Attached Files Attached Files

  24. #24
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    Please see attached.

    I also added an error-handler to return a 0 instead of #DIV/0! error when a time slot doesn't exist in the database...

    Please Login or Register  to view this content.
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    Ok great. I adjusted it slightly as I realized it was aggregating for a time earlier than I wanted it to. Now I changed the start time of each day to 7:00 am. After doing this, I see that in p4 the average for 7:00 am reads 746.5 but it should be 20+6+1/3 which would be 9 - and then continue to aggregate the averages as each minute goes by. I've attached it again.
    Attached Files Attached Files

  26. #26
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    Do you mean in P2?

    Please Login or Register  to view this content.
    copied down..

  27. #27
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    Yes I did. Got it, perfect that is awesome. Thank you.

  28. #28
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    Great, please don't forget to mark the thread as Solved... and close off any lingering threads you have open.

  29. #29
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    Thank you. One more small question - anyway to do something that will allow me to have the values in P2 and below reflect the current time? So for whichever time it is currently the volume at that time is shown? Thank you.

  30. #30
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    Don't know what you mean.. you want to change O2 to =NOW() and O3 to =O2+TIME(0,1,0) copied down?

  31. #31
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    Sorry, I mean in a seperate sheet I want to be able to say ok if =NOW() is 7:00 am - meaning that is the current time of the day - then it displays the 9 which corresponds to when O2 is 7:00 am.

  32. #32
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    tRY:

    Please Login or Register  to view this content.
    Where C4 is cell containing formula =NOW() on another sheet...

  33. #33
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    That just shows me the data value for the vert last time referenced in O2

  34. #34
    Registered User
    Join Date
    06-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Average Formatting

    Is there anyway to do this using a vlookup, perhaps?

  35. #35
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average Formatting

    That is like a vlookup! Implement it properly!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1