unique values with criteira.

mmitch

New Member
Joined
Sep 4, 2018
Messages
2
hi

i'm trying to calulate otif (on time in full) for deliveries we make.
B has the order number - i can calulate the number if unique orders (three)

I cannot work out how to calulate how many order were in full (c=3 and I = blank)
(c = 1 ordered, c=3 delivered, I = action: Backorder, Deleted or blank)
in this example, order 42211 was in full
42208 had a B (backorder) and D (deleted) in I so not in full
42210 bad a B (backorder) in I so not in full.

when i go live, there will be 6000 - 10000 lines a day, and i'll run the calulation for a week, so 30000 to 60000 line

A B C D E F G H I
12/06/2018422081105 13/06/2018
MM
B
12/06/201842208310513/06/201813/06/2018
MM
12/06/20184220811113/06/2018 MM
12/06/20184220831113/06/201813/06/2018 MM
D
12/06/20184221011113/06/2018
MM
12/06/20184221031013/06/2018 MM
B
12/06/20184221011113/06/2018 MM
12/06/20184221031113/06/201813/06/2018 MM
12/06/20184221011113/06/2018
MM
12/06/20184221031013/06/2018
MM
12/06/20184221011113/06/2018 MM
12/06/20184221031113/06/201813/06/2018 MM
12/06/20184221111113/06/2018 MM
12/06/20184221131113/06/201813/06/2018 MM

<colgroup><col style="mso-width-source:userset;mso-width-alt:2702;width:57pt" width="76"> <col style="width:48pt" width="64" span="2"> <col style="mso-width-source:userset;mso-width-alt:3726;width:79pt" width="105"> <col style="mso-width-source:userset;mso-width-alt:1507;width:32pt" width="42"> <col style="mso-width-source:userset;mso-width-alt:2759;width:58pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:2929;width:62pt" width="82"> <col style="width:48pt" width="64" span="2"> </colgroup><tbody>
</tbody>
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
try this on a separate sheet -- do not test directly on your work.

Crude but I think it worked.
hope this helps
thanks..

check this sample..https://www.dropbox.com/s/q060gkyyg3e9ozg/mmitch.xlsm?dl=0

Code:
Sub UpdateData()
    Sheets("Sheet1").Select
    mlr = Cells(Rows.Count, "B").End(xlUp).Row
    Application.ScreenUpdating = False
    On Error Resume Next
    Dim i As Long
    For i = 2 To mlr
        If Cells(i, "I") = "" Then
            Range("XFD" & i) = 0
        Else
            Range("XFD" & i) = 1
        End If
        If Cells(i + 1, "B") <> Cells(i, "B") Then
            If Application.Sum(Range("XFD:XFD")) = 0 Then
                Cells(i, "J") = "FULL"
            Else
                Cells(i, "J") = "NOT FULL"
            End If
            Columns(16384).Clear
        End If
    Next i
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
    On Error GoTo 0
    Range("A2").Select
End Sub
 
Last edited:
Upvote 0
thanks. perfect

how does it work?

i understand the the basic code, but not the excel bits
(for next and if then I understand)
 
Upvote 0
the only code that I don't know is how to establish that there is a B or D along the column I - so I used a helper column (XFD - the farthest so as not to hamper any columns in between) - if the cell is empty, I assigned zero and one for the others - then I get the sum - if it is zero then there are no B nor D , meaning FULL.
hope that helped.
thanks..
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top