+ Reply to Thread
Results 1 to 14 of 14

Calculating Frequency of visits/usage at a car park

  1. #1
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Calculating Frequency of visits/usage at a car park

    Hi Guys

    Any ideas on this will be much appreciated. I'm looking at calculating the frequency of visits( once, twice,....) to a car park by customers( represented by vehicle registration number) in year. The visit must be unique/distinct to each day, that is, if a customer visits many times in a day, it is considered as a single day visit.Also under each frequency I want to know the total minutes spent and total cost of parking. The data is massive so I'm wondering what will be the best approach, using formula or pivot?


    Many thanks
    Attached Files Attached Files
    Last edited by FredFitzgerald; 11-08-2016 at 02:18 AM.

  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,874

    Re: Calculating Frequency of visits/usage at a car park

    When providing a workbook, it needs to include some expected outcomes - please add some to your attachment. Do I assume correctly that the X across the top represent numbers of visits? What happens if there have been more than five?
    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
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Calculating Frequency of visits/usage at a car park

    Apologies AliGW, I've updated the spreadsheet with some samples. Yes, X1 = Single visits, X2= visiting twice etc. Customers visiting more than 4 times will fall under >X4.The visit must be unique/distinct to each day, that is, if a customer visits many times in a day, it is considered as a single day visit.


    Thanks
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Calculating Frequency of visits/usage at a car park

    VBA solution .....

    Please Login or Register  to view this content.
    Click RUN to execute

    It will need modifying to account for variable number of registrations: either a given maximum or a "dynamic" calculation of rows need for results table.

    I recommend having the "input" and "output" on separate sheets.

    Note: the "Input" data is sorted by Registration then Date.
    Attached Files Attached Files
    Last edited by JohnTopley; 11-08-2016 at 05:38 AM.

  5. #5
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Calculating Frequency of visits/usage at a car park

    Many thanks John. Much appreciated. I have a follow on question if you don't mind. What will be the script if the input and output references change as follows:

    OUTPUT SHEET
    Sheet1: A14:K575770

    INPUT SHEET
    Q1 = B3:B788508
    Q2 = B3:G802348
    Q3 = B3:G799322
    Q4 = B3:G786563

    I'be made these changes because the annual data is very large so I've divided it 4 quarters in 4 separate sheets. As advised, the output data is in sheet1 alone.

    Thanks
    Last edited by FredFitzgerald; 11-08-2016 at 07:55 AM.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Calculating Frequency of visits/usage at a car park

    Do you have any idea of the maximum number of registrations in a quarter?

    Are you saying there is > 550,000???

    And would it be OK to put Total row at head of output table i.w in row 14: saves scrolling down 100's of rows!

    or better only place totals in "Summary".
    Last edited by JohnTopley; 11-08-2016 at 09:19 AM.

  7. #7
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Calculating Frequency of visits/usage at a car park

    Yes, I summerised the data for distinct vehicle registration number and there are 575000
    I think the summary table is enough so ignore the total below.

    Thanks

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Calculating Frequency of visits/usage at a car park

    Please Login or Register  to view this content.

    Drop-down to select Quarter and TOTALS only in SUMMARY.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Calculating Frequency of visits/usage at a car park

    Volume tests on the original code took forever so now modified the code to use "in memory" processing.

    This processed over 560,000 records with 530,00+ VRNs in about 10 seconds.

    I can't post the file with volume data as it is far too large.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JohnTopley; 11-08-2016 at 04:42 PM.

  10. #10
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Calculating Frequency of visits/usage at a car park

    Many thanks. I run the new script and got an error "Run-time error '7': Out of Memory. I tried to debug and this portion was highlighted ReDim OutArr(1 To UBound(inArr, 1), 1 To 11)

  11. #11
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Calculating Frequency of visits/usage at a car park

    I just reduced the volume of data across the 4 input sheets( Q1 - Q4) to 500,000 records each and it run successfully on average 3.8 secs. I guess the error I got is due the volume, perhaps I need to break it down more and add another sheet.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Calculating Frequency of visits/usage at a car park

    Yes ... 500,000 x 11 array is a lot of storage: I wasn't sure what volume it would handle so it is "trial and error" but it managed approx 570,000 on my machine.

    Your m/c is obviously faster than mine as mine took nearly 10 secs for 570,000!!!

    But compared to reading/writing out the rows (as my original macro) it is lightening fast!

    Subject to the volume question .....

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

  13. #13
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Calculating Frequency of visits/usage at a car park

    I must say I'm impressed with your solution, many thanks.

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Calculating Frequency of visits/usage at a car park

    Thank you for the feedback and rep.

+ 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. Match criteria for calculating a summary of usage
    By Anuru in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-11-2016, 05:20 AM
  2. Need a formula that calculates vacation accrual and usage based on hours worked
    By excelnewbie101 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2015, 01:41 PM
  3. Calculating number of return visits in 24 hours...
    By tbonecopper in forum Excel General
    Replies: 7
    Last Post: 12-12-2014, 01:45 AM
  4. Replies: 4
    Last Post: 12-09-2014, 10:27 AM
  5. Calculating usage over time ranges
    By njmike in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 04-09-2014, 10:28 AM
  6. count / frequency of visits with conditions
    By maymano in forum Excel General
    Replies: 3
    Last Post: 08-19-2011, 03:32 AM
  7. Calculating usage of drop-down choices on separate sheet
    By BlondOIverBlue in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-27-2011, 09:12 PM

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