Progress in two nested loops

Formula to show progress to end user from inside two loops.
More like an article than code piece.
Additional part on how to apply it to Frm73

What is this?



Original Work
If we need to get percentage of progress to show to user, we have two conditions:
    1- If we have one loop:
        a. B1 is the current item we are in
        b. B2 is the total number of items
        c. Formula is: P% = B1/B2 * 100
    2- If we have two loops, one inside the other
        a. Example used is we have 17 houses we need to go through
        b. Each house has 6,500 bricks
        c. We need to go through each brick in each of these houses
        d. To get the total percentage of overall progress, we do formula as
        e. B1 is the brick we are currently in
        f. B2 is total number of bricks in each house
        g. H1 is house we are in
        h. H2 is total number of houses
        i. Formula: P% = (( B1 + ( ( H1 -1 ) * B2 ) ) / ( B2 * H2)) * 100
        j. Translation: The number of houses completed x number of bricks in each house + Current brick we are in / total number of bricks in all houses
    4- 2 loops + Progressbar using Frm7
        a. Max1 = last number of out loop
        b. X1 = Current ID for out loop
        c. Max2 = last number of in loop
        d. X2 = Current ID for in loop
        P11 = X2 + ((X1-1)*Max2)
        P12 = Max1 * Max2
        P13 = P11 * (310 - 2)/P2
        Frm7.Lbl1.Caption = "Analyzing: " & Format(P11, "0.0") & " / " & Format(P12, "0.0") & " (" & Format(P11/P12*100, "0.00") & "%)"
        Frm7.Lbl2.Width = P13
        Frm7.Lbl3.Caption="Total cells: " & Format(P11, "0.0")

Views 74

Downloads 32