pinky - 1 year ago 60

Python Question

I have tried long long hour to do this but i stuck.

I have many machines produce boxes, each box contained items.

All items, boxes are serial tagged.

I want to produce the sequence count based on box_sn as result in the picture.

I wish pandas dataframe solution or and excel formula. can any experts give me a hints to solve this?

thank you.

edited:

i am able to generate the sequence number based on single catergories as in picture below.

with formula : G2 = IF(B2<>B1,G1+1,G1)

this will continue sequence the box_sn, but i want machine B box_sn restart the sequence.

Answer

Based on your edit, an Excel solution would be (entered in column F):

```
=IF(A2<>A1,1,IF(B2=B1,F1,F1+1))
```

Source (Stackoverflow)