Hello everyone...
Please help..... I'm really stuck to find the best solution/formula to solve my situation.
As you can see from my table below, I need to create new Inv. number if the customer cust. order no. changed even if they have the same Inv. no.
The first cust. order no. will have the same invoice no., but the second, third and so on will need to add 2, 3 and so on sequentially (no hyphen is also ok).
But if there 2 invoice no. with the same customer order number, then the second invoice number will need to take the last 2 digits of the other invoice number.
The M column is the new Invoice number that I need to create.
I was thinking that if I could find and show the nth occurance of the customer invoice no. in one invoice number, then perhaps I could create the new invoice number.
but I was stuck with what kind formula I can use to achieve this. I tried several formula but still couldn't find the correct one.
Please help..... I'm really stuck to find the best solution/formula to solve my situation.
As you can see from my table below, I need to create new Inv. number if the customer cust. order no. changed even if they have the same Inv. no.
The first cust. order no. will have the same invoice no., but the second, third and so on will need to add 2, 3 and so on sequentially (no hyphen is also ok).
But if there 2 invoice no. with the same customer order number, then the second invoice number will need to take the last 2 digits of the other invoice number.
The M column is the new Invoice number that I need to create.
I was thinking that if I could find and show the nth occurance of the customer invoice no. in one invoice number, then perhaps I could create the new invoice number.
but I was stuck with what kind formula I can use to achieve this. I tried several formula but still couldn't find the correct one.
test for HKB.xlsx | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | |||
1 | Inv no. | Sales date | Delivery date | Delivery time | Data Order No. | Cust. Order no. | Customer code | Row | total row of the same order no. | Combination | 1 Cust. Order No. How many Data Order no. | 1 Data order no. how many Cust. Order no. | New Inv. No. | ||
2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ||||||||
3 | 863240 | 2024/6/4 | 2024/6/5 | AM | 889029 | 7105433 | HKB01000 | 1 | 2 | 8890297105433 | 1 | 2 | 863240 | ||
4 | 863240 | 2024/6/4 | 2024/6/5 | AM | 889029 | 7105495 | HKB01000 | 1 | 2 | 8890297105495 | 1 | 2 | 863240-2 | ||
5 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106345 | HKB01000 | 1 | 18 | 8892197106345 | 1 | 4 | 863255 | ||
6 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106345 | HKB01000 | 2 | 18 | 8892197106345 | 1 | 4 | 863255 | ||
7 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106345 | HKB01000 | 3 | 18 | 8892197106345 | 1 | 4 | 863255 | ||
8 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106345 | HKB01000 | 4 | 18 | 8892197106345 | 1 | 4 | 863255 | ||
9 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106345 | HKB01000 | 5 | 18 | 8892197106345 | 1 | 4 | 863255 | ||
10 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106345 | HKB01000 | 6 | 18 | 8892197106345 | 1 | 4 | 863255 | ||
11 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106346 | HKB01000 | 1 | 18 | 8892197106346 | 1 | 4 | 863255-2 | ||
12 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106346 | HKB01000 | 2 | 18 | 8892197106346 | 1 | 4 | 863255-2 | ||
13 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7106346 | HKB01000 | 3 | 18 | 8892197106346 | 1 | 4 | 863255-2 | ||
14 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108296 | HKB01000 | 1 | 18 | 8892197108296 | 1 | 4 | 863255-3 | ||
15 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108296 | HKB01000 | 2 | 18 | 8892197108296 | 1 | 4 | 863255-3 | ||
16 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108296 | HKB01000 | 3 | 18 | 8892197108296 | 1 | 4 | 863255-3 | ||
17 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108296 | HKB01000 | 4 | 18 | 8892197108296 | 1 | 4 | 863255-3 | ||
18 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108296 | HKB01000 | 5 | 18 | 8892197108296 | 1 | 4 | 863255-3 | ||
19 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108296 | HKB01000 | 6 | 18 | 8892197108296 | 1 | 4 | 863255-3 | ||
20 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108297 | HKB01000 | 1 | 18 | 8892197108297 | 2 | 4 | 863255-4 | ||
21 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108297 | HKB01000 | 2 | 18 | 8892197108297 | 2 | 4 | 863255-4 | ||
22 | 863255 | 2024/6/4 | 2024/6/5 | AM | 889219 | 7108297 | HKB01000 | 3 | 18 | 8892197108297 | 2 | 4 | 863255-4 | ||
23 | 863256 | 2024/6/4 | 2024/6/6 | AM | 889227 | 7108297 | HKB01000 | 4 | 1 | 8892277108297 | 2 | 1 | 863256-55 | ||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
H3:H23 | H3 | =IF(OR(H2="",H2=6,F3<>F2),1,H2+1) |
I3:I23 | I3 | =COUNTIF(E:E,E3) |
J3:J23 | J3 | =CONCATENATE(E3,F3) |
K3:K23 | K3 | =IF(A3="","",SUM(--(LEN(UNIQUE(FILTER($A$3:$A$50,($F$3:$F$50=F3),"")))>0))) |
L3:L23 | L3 | =IF(A3="","",SUM(--(LEN(UNIQUE(FILTER($F$3:$F$49,($E$3:$E$49=E3),"")))>0))) |