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
MM
MM
MM
D

MM
MM
B
MM
MM

MM

MM
MM
MM
MM
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>
[TD="class: xl65, width: 76, align: right"]12/06/2018[/TD]
[TD="width: 64, align: right"]42208[/TD]
[TD="width: 64, align: right"]1[/TD]
[TD="width: 105, align: right"]10[/TD]
[TD="width: 42, align: right"]5[/TD]
[TD="class: xl65, width: 78, align: right"] 13/06/2018
[/TD]
[TD="width: 82"][/TD]
[TD="width: 64"] MM
[/TD]
[TD="width: 64"]B[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42208[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]5[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]
[TD="class: xl65, align: right"]13/06/2018
[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42208[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42208[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42210[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42210[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42210[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42210[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42210[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42210[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42210[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42210[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42211[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

[TD="class: xl65, align: right"]12/06/2018[/TD]
[TD="align: right"]42211[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]
[TD="class: xl65, align: right"]13/06/2018[/TD]

</tbody>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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