+ Reply to Thread
Results 1 to 4 of 4

Want to count no. Of rows covered in every passing minute

  1. #1
    Registered User
    Join Date
    01-09-2022
    Location
    UK
    MS-Off Ver
    2019
    Posts
    7

    Want to count no. Of rows covered in every passing minute

    Hi,

    Let me explain

    I have a column F with time data in it. The time is in this format 24:00 (24 hour). i want to know how many no. of rows have been covered in each minute.

    for example in cells,

    F4 21:28
    F5 21:28
    F6 21:28
    F7 21:28
    F8 21:28
    F9 21:28
    F4 21:29
    in 28th minute 6 rows were covered.

    I want a VBA Code that counts the no. of rows covered in each minute and write them in column H from cell H4. Please also note that in column F time data is not being added manually rather it is being updated from external source automatically.

    Let i starts importing data at 21:28 then VBA Code should took 28 as reference and keep counting until time changes to 21:29. Code should write count data for 28th minute in H4. Then again it should start recounting from 29th minute as long as time changes to 21:30. and write data for 29th minute in H5 and so on.

    (there is solution of using Pivot Table, but i don't need that because data in pivot table does not updates as data in column F changes automatically Live. So, i want such a VBA code that counts no. of rows covered in every passing minute and keep writing it from cell H4 onward. Also this VBA code should work with this live updating data)

    (I have attached a file for further clarification)
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,208

    Re: Want to count no. Of rows covered in every passing minute

    It is very important that you explain how the data is automatically updated, because the solution may depend on it. DDE or some other macro?

    Artik

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Want to count no. Of rows covered in every passing minute

    A power query Solution option

    Please Login or Register  to view this content.
    Excel 2016 (Windows) 32 bit
    H
    I
    4
    Time Count
    5
    9:28 PM
    45
    6
    9:29 PM
    51
    7
    9:30 PM
    59
    8
    9:31 PM
    57
    9
    9:32 PM
    55
    10
    9:33 PM
    55
    11
    9:34 PM
    67
    12
    9:35 PM
    52
    13
    9:36 PM
    42
    14
    9:37 PM
    51
    15
    9:38 PM
    25
    16
    9:39 PM
    32
    17
    9:40 PM
    33
    18
    9:41 PM
    65
    19
    9:42 PM
    48
    20
    9:43 PM
    54
    21
    9:44 PM
    16
    Sheet: Sheet1

    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,461

    Re: Want to count no. Of rows covered in every passing minute

    Put code in worksheet_Calculate even (rightclick on sheetname,view code)
    PHP Code: 
    Private Sub Worksheet_Calculate()
    Dim Lr&, count&
    Dim key
    Dim m 
    As Double
    Dim cell 
    As Range
    Dim dic 
    As Object
    Set dic 
    CreateObject("Scripting.dictionary")
    Lr Cells(Rows.count"F").End(xlUp).Row
        
    For Each cell In Range("F4:F" Lr)
        
    Minute(cell.Value)
            If 
    Not dic.exists(mThen
                dic
    .Add m""
            
    End If
        
    Next
            
    For Each key In dic.keys
                    
    For Each cell In Range("F4:F" Lr)
                         
    Minute(cell.Value)
                         If 
    key Then count count 1
                    Next
                Cells
    (4"G").Value key ' write minute on column G, Remove this line if no need
                Cells(k + 4, "H").Value = count ' 
    write minute count onto column H
                k 
    1
                count 
    0
            Next
    End Sub 
    Last edited by bebo021999; 01-09-2022 at 11:00 PM.
    Quang PT

+ 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. I want a code that can count the no. of rows covered in an hour using the timestamps
    By John521520 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-06-2022, 09:16 PM
  2. [SOLVED] Count number of revenue months until cost is covered
    By macrorookie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-05-2020, 04:47 PM
  3. count the number of 15 minute increments between two times
    By shaun.burke in forum Excel General
    Replies: 3
    Last Post: 08-20-2019, 11:04 PM
  4. Count Number of Times Per Minute
    By Pryach in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-31-2018, 11:49 AM
  5. Need a Repeat 30 Minute Count Down Clock
    By neckbone30 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-04-2013, 01:09 PM
  6. count the no. of cell changes (+1 or -1) in a minute
    By Sarangsood in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2011, 02:20 AM
  7. count no of due days covered between 2 dates
    By Ganesh A in forum Excel General
    Replies: 4
    Last Post: 12-30-2007, 08:04 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