+ Reply to Thread
Results 1 to 20 of 20

Finding the Average of Unequally distributed sorted data

  1. #1
    Registered User
    Join Date
    08-01-2016
    Location
    Victoria Gozo, Malta
    MS-Off Ver
    2016
    Posts
    7

    Finding the Average of Unequally distributed sorted data

    Hi All,

    I have some wind speed data obtained from LIDAR which I need to analyse. The LIDAR takes several wind speed data points every minute... it's not fixed but random - for example from 02:00 till 02:01 it can take 4 data points and from 02:01 to 02:02 it can take 3 data points. I would like to sort this data in 10 mins to be able to find the average wind speed values from say 02:00 till 02:09, 02:10 to 02:19, 02:20 to 02:29 and so on.

    I have managed to sort the data into 10 minutes values as per attached excel file. But I'm having trouble using the autofill feature in Excel to find the average wind speed values because the data points are not equally distributed and considering that I have 12 months of data it's unattractive to find the average manually.

    I have also attached a sample file. Any help would be greatly appreciated.

    Thanks in advanced.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    Try this in D2 copied down:

    =IF(B2=B1,"",AVERAGEIF(B:B,B2,C:C))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-01-2016
    Location
    Victoria Gozo, Malta
    MS-Off Ver
    2016
    Posts
    7

    Re: Finding the Average of Unequally distributed sorted data

    Thank you ever so much for your kind and fast help! It has worked!!

    If I understand correctly, you' are asking excel to perform the average only if the filters are equal, right?

    Thanks again!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    Yes. Basically, at each point that the filter increases, it averages all the data with that new filter number. I presume you have a formula to generate the filter number?

    AVERAGEIFS looks at a range and checks that it is equal to the lookup cell, then averages every row that matches the lookup cell.

  5. #5
    Registered User
    Join Date
    08-01-2016
    Location
    Victoria Gozo, Malta
    MS-Off Ver
    2016
    Posts
    7

    Re: Finding the Average of Unequally distributed sorted data

    Sorry for bothering you again, but I tried doing them manually to verify the answers... the formula you gave me does not match with the average.

    Yes, the formula is =FLOOR(MINUTE(A2),10)
    Last edited by unitedtillidie; 08-01-2016 at 05:02 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    Quote Originally Posted by unitedtillidie View Post
    Sorry for bothering you again, but I tried doing them manually to verify the answers... the formula you gave me does not match with the average.
    Yes, so it seems. No idea why! Sorry.

  7. #7
    Registered User
    Join Date
    07-26-2016
    Location
    Torun, Poland
    MS-Off Ver
    2007/2010/2013
    Posts
    23

    Re: Finding the Average of Unequally distributed sorted data

    I think, that formula of @AliGW makes the average of EVERY filter in database witch contains the same number (ex. 0), not only in the range of next ten seconds (if I see correctly from @unitedtillidie example, you are making average from every 10 sec. not minutes).
    Last edited by Feronen; 08-01-2016 at 05:12 AM.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    Quote Originally Posted by Feronen View Post
    I think, that formula of AliGW makes the average of EVERY filter in database witch contains the same number (ex. 0), not only in the range of next ten minutes.
    If I step through the evaluation of the formula, it works correctly, identifying just 0 as the filter. I think it may be another manifestation of the floating points issue that is sometimes discussed here.

  9. #9
    Registered User
    Join Date
    08-01-2016
    Location
    Victoria Gozo, Malta
    MS-Off Ver
    2016
    Posts
    7

    Re: Finding the Average of Unequally distributed sorted data

    Yes, most probably that is what's happening.

    Is there another formula that calculates the average in the range of the next ten minutes? Or alternatively, can I filter the data so that it increments?

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    Right - here's what I would do: change the filter column to a letter (e.g. A for 0, B for 10, etc.) and then my formula will work fine.

    If you round up, it's perfect:

    =ROUNDUP(AVERAGEIF(B:B,B2,C:C),2)

    EDIT: I've just realised that you have the filter value repeating further down! You need to have a DIFFERENT filter value for each ten-minute slot. That's the problem! Doh! Why didn't I see that before ...
    Last edited by AliGW; 08-01-2016 at 05:18 AM.

  11. #11
    Registered User
    Join Date
    08-01-2016
    Location
    Victoria Gozo, Malta
    MS-Off Ver
    2016
    Posts
    7

    Re: Finding the Average of Unequally distributed sorted data

    Quote Originally Posted by AliGW View Post
    Right - here's what I would do: change the filter column to a letter (e.g. A for 0, B for 10, etc.) and then my formula will work fine.

    If you round up, it's perfect:

    =ROUNDUP(AVERAGEIF(B:B,B2,C:C),2)

    EDIT: I've just realised that you have the filter value repeating further down! You need to have a DIFFERENT filter value for each ten-minute slot. That's the problem! Doh! Why didn't I see that before ...
    Thanks a lot AliGW and Feronen.

    One small issue... to replace the filters with letters, do I have to replace them manually? Because I can't use the Find/Replace in case there are wind speed values which are 0, 10 etc...

    Thanks again guys
    Last edited by unitedtillidie; 08-01-2016 at 05:33 AM.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    You can do find and replace just on that column, but it won't help, as I explained in my edit above. The problem is the filter column. I am just working on an automated solution for you - give me a few minutes.
    Last edited by AliGW; 08-01-2016 at 05:54 AM.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    OK - here we go!

    In B2, type 0.

    In B3, type this and copy down to the last cell in the range:

    =IF(MOD(MINUTE(A3),10)=MOD(MINUTE(A2),10),B2,IF(MOD(MINUTE(A3),10)=0,B2+1,B2))

    This will increment the filter column by 1 every 10 minutes and allow the AVERAGEIF formula to function correctly.

    Use this in column D:

    =IF(B2=B1,"",AVERAGEIF(B:B,B2,C:C))

  14. #14
    Registered User
    Join Date
    08-01-2016
    Location
    Victoria Gozo, Malta
    MS-Off Ver
    2016
    Posts
    7

    Re: Finding the Average of Unequally distributed sorted data

    Quote Originally Posted by AliGW View Post
    OK - here we go!

    In B2, type 0.

    In B3, type this and copy down to the last cell in the range:

    =IF(MOD(MINUTE(A3),10)=MOD(MINUTE(A2),10),B2,IF(MOD(MINUTE(A3),10)=0,B2+1,B2))

    This will increment the filter column by 1 every 10 minutes and allow the AVERAGEIF formula to function correctly.

    Use this in column D:

    =IF(B2=B1,"",AVERAGEIF(B:B,B2,C:C))
    Thank you so much AliGW! I have tried the formulas on the real data, checked them and they have all worked! You are the KING :D Thanks again!

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    I hope that I am a queen rather than a king, but you are very welcome!

    It may be that someone else will work out a more elegant formula that does the same thing, but at least it works.

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  17. #17
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Finding the Average of Unequally distributed sorted data

    Quote Originally Posted by unitedtillidie View Post
    ... You are the KING ...
    Well, QUEEN probably.

    I would have thought it would be more useful to you to have a separate table where you list date/times in 10 min increments and then have the averages in an adjacent column, rather than have large blanks in your table.

    Pete

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    Quote Originally Posted by Pete_UK View Post
    Well, QUEEN probably.

    I would have thought it would be more useful to you to have a separate table where you list date/times in 10 min increments and then have the averages in an adjacent column, rather than have large blanks in your table.

    Pete
    I agree, Pete, but at least the OP has what they asked for.

  19. #19
    Registered User
    Join Date
    08-01-2016
    Location
    Victoria Gozo, Malta
    MS-Off Ver
    2016
    Posts
    7

    Re: Finding the Average of Unequally distributed sorted data

    Quote Originally Posted by AliGW View Post
    I hope that I am a queen rather than a king, but you are very welcome!

    It may be that someone else will work out a more elegant formula that does the same thing, but at least it works.
    Haha, I should have paid more attention to your dp! You're the QUEEN AliGW :D Thanks, once again.

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding the Average of Unequally distributed sorted data

    Quote Originally Posted by unitedtillidie View Post
    Haha, I should have paid more attention to your dp! You're the QUEEN AliGW :D Thanks, once again.
    Hehehe! You're welcome.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Keeping a running average of sorted data
    By ExelDummy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2015, 04:18 PM
  2. interpolation unequally spaced data for stocks quotes in excel
    By alblacroix in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 03-31-2015, 02:50 PM
  3. Help finding Average in Data Set
    By andyaf in forum Excel General
    Replies: 2
    Last Post: 01-31-2014, 02:56 AM
  4. Average Distributed
    By rilindo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-21-2013, 08:44 AM
  5. Plotting data as an area chart with unequally spaced x values
    By Koala8 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-14-2012, 01:56 PM
  6. Finding the nearest value of a column that is not sorted.
    By f0r3st in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-13-2009, 05:37 AM
  7. [SOLVED] Distributed retrival:average value
    By Ulf in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 AM

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