+ Reply to Thread
Results 1 to 16 of 16

Speed controls, how to calculate average speed.

  1. #1
    Registered User
    Join Date
    04-07-2022
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    8

    Speed controls, how to calculate average speed.

    Im an intern workin with taking speed controls on public roads, and doing a median value of it is very intresting as you can guess.


    hm.png

    left side is the speed, and the right side is total number of cars within the range.


    I can not figure out how excel can calculate this automaticly.


    Any ideas?


    -R

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

    Re: Speed controls, how to calculate average speed.

    How about this?

    =INDEX($B$5:$B$19,MATCH(MEDIAN($C$5:$C$19),$C$5:$C$19,0))

    B contains the speeds and C contains the values.

    You will need to change commas to semi-colons for your Swedish locale.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: Speed controls, how to calculate average speed.

    Assuming your data is in the same position as Ali suggests (B5:C19), then perhaps this would work?

    =SUMPRODUCT((SUBSTITUTE(B5:B19,"<=",""))*(C5:C19))/SUM(C5:C19)

    Combined total of speeds * cars (74,510) divided by total of cars (1,838) = 40.5 km/h.

    Of course the number isn't truly accurate as there's a 5km/h leeway in each speed bracket, meaning everyone in the <=35 bracket for example could all be travelling at 31 and that will affect the figure.

    My maths could be completely incorrect altogether, but without an example output it's difficult to know what you're expecting.

    BSB

  4. #4
    Registered User
    Join Date
    04-07-2022
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    8

    Re: Speed controls, how to calculate average speed.

    I tried both of your examples, changed it to =INDEX($B$6:$B$20;MATCH(MEDIAN($C$6:$C$20);$C$6:$C$19;0))

    But all I got as result was "#NAME?"

    BSB, I can do a better example of what i excpect as outcome.


    hm.png


    Avg speed is about 38 km/h, but I understand the problem with brackets.
    Last edited by AliGW; 04-07-2022 at 05:10 AM. Reason: PLEASE don't quote unnecessarily!

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: Speed controls, how to calculate average speed.

    Maybe this?

    =SUMPRODUCT((SUBSTITUTE(B5:B19,"<=","")-2.5)*(C5:C19))/SUM(C5:C19)

    By adding the part in red it will calculate the average based on the middle value of each speed bracket and results in 37.5.

    BSB

  6. #6
    Registered User
    Join Date
    04-07-2022
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    8

    Re: Speed controls, how to calculate average speed.

    I realised that the problem was the language, so I changed it to =PRODUKTSUMMA((BYT.UT(O6:O20,"<=","")-2.5)*(P6:P20))/SUMMA(P6:P20)
    And it seems to work, avg 37.5 is close enough, gonna try it on more examples to see the difference.

    Problem is, Im gonna fill up more space i.e perhaps next time someone is going over 80 / 85 and so on, and i wanna ignore all empty spaces so I dont get "incorrect values"

    Or else I have to manually adjust it every time, sometimes it is more, some times its less.


    -R

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: Speed controls, how to calculate average speed.

    You could use "dynamic named ranges" that will expand/shrink as you add/remove data.

    See attached and pres Ctrl+F3 to open the named range manager. The named range formulas may need amending slightly depending on the layout of your actual file.

    Or you could use structured tables.

    BSB
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-07-2022
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    8

    Re: Speed controls, how to calculate average speed.

    Ah okey, I have a column that is from b5 to b37, and I dont want to expand or shrink it, since there is alot more info around it and it would look weird.

    I can not open (edit) excel documents that has been downloaded from internet due to my Organisation has blocked it.

    Is there any other way to ignore the empty spaces?

    hm.png

    -R
    Last edited by Hejhallo; 04-07-2022 at 05:09 AM.

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: Speed controls, how to calculate average speed.

    Would it be possible to see a copy of your file with no sensitive data included?

    If you can highlight the area you'd put this data in then perhaps I can help you set up the dynamic named ranges.

    BSB

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

    Re: Speed controls, how to calculate average speed.

    Here's the Swedish version of my suggestion:

    =INDEX($B$5:$B$19;PASSA(MEDIAN($C$5:$C$19);$C$5:$C$19;0))

  11. #11
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: Speed controls, how to calculate average speed.

    If your speed brackets column just said 5, 10, 15 etc. rather than <=5, <=10 etc then the formula would work even with blank rows.

    =PRODUKTSUMMA((O6:O20-2.5)*(P6:P20))/SUMMA(P6:P20)

    Just change the 20s in the formula to whatever your maximum row number would be

    BSB

  12. #12
    Registered User
    Join Date
    04-07-2022
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    8

    Re: Speed controls, how to calculate average speed.

    Yes, I understand.
    Thing is this info is copypasted from an 3rd party app and it is not possible to choose the content your copying, brackets included. :/

    Just wanted also to say thanks, for solving the originally asked question.

    I have more math equations and things that needs to be solved if you are intrested?

    -R

  13. #13
    Registered User
    Join Date
    04-07-2022
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    8

    Re: Speed controls, how to calculate average speed.

    Quote Originally Posted by AliGW View Post
    Here's the Swedish version of my suggestion:

    =INDEX($B$5:$B$19;PASSA(MEDIAN($C$5:$C$19);$C$5:$C$19;0))
    Thank you for effort, now that BSB has done alot, and also he figured out to get correct info also using his math skills, im gonna use that

  14. #14
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: Speed controls, how to calculate average speed.

    Quote Originally Posted by Hejhallo View Post
    I have more math equations and things that needs to be solved if you are intrested?
    If they're not directly related to the question in this thread then feel free to start new threads for your other questions and we'll do what we can to help.

    BSB

  15. #15
    Registered User
    Join Date
    04-07-2022
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    8

    Re: Speed controls, how to calculate average speed.

    They sort of is, I guess.
    Same thing, but to exclude the 15% slowest drivers, and only calculate average of the remaining 85%
    Last edited by AliGW; 04-07-2022 at 06:32 AM. Reason: PLEASE don't quote unnecessarily!

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

    Re: Speed controls, how to calculate average speed.

    No, this is a completely different calculation. Please start a NEW thread with a SUITABLE title.

    I will mark this thread as SOLVED.

+ 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. How to avoid cell SELECTION but still format cells to speed up the macro running speed
    By BeefyBerts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2018, 08:18 AM
  2. Everage Speed km/time (european speed)
    By GerryZucca in forum Excel General
    Replies: 3
    Last Post: 02-23-2015, 03:02 PM
  3. Average Speed need...
    By rameshs12251984 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-06-2013, 09:31 AM
  4. Excel 2007 : average speed
    By ianmark in forum Excel General
    Replies: 10
    Last Post: 07-19-2009, 12:20 AM
  5. average speed?
    By William Stokes in forum Excel General
    Replies: 3
    Last Post: 06-05-2006, 08:35 AM
  6. [SOLVED] Calculate average speed
    By 41db14 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-15-2006, 02:55 PM
  7. average speed
    By Rob in forum Excel General
    Replies: 2
    Last Post: 01-08-2006, 03:00 PM

Tags for this Thread

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