CaptainGravyBum
Board Regular
- Joined
- Dec 1, 2023
- Messages
- 77
- Office Version
- 365
- Platform
- Windows
Morning,
I had some help with a formula on a previous post which is working well, but it will only work if there are the same number of rows every time. If I try to copy the formula down the sheet, all results will give me an error.
Is there a way round this? Basically, the number of rows will change depending on the data imported from another sheet, so the idea of the formula is that is will adjust accordingly.
If it's not possible to make the formula to adapt this way, I'm happy to add it as a macro when the sheet is activated, if someone can help me define the last row to update the formula each time.
I had some help with a formula on a previous post which is working well, but it will only work if there are the same number of rows every time. If I try to copy the formula down the sheet, all results will give me an error.
Is there a way round this? Basically, the number of rows will change depending on the data imported from another sheet, so the idea of the formula is that is will adjust accordingly.
If it's not possible to make the formula to adapt this way, I'm happy to add it as a macro when the sheet is activated, if someone can help me define the last row to update the formula each time.
Book1 | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Article number | Order number | Count | Order Count | |||
2 | PBB12(MKM1) | 204021 | 250 | ||||
3 | PBB12(MKM1) | 204021 | 250 | 500 | |||
4 | PFCF11E | 204012 | 2 | 2 | |||
5 | PFCF11E | 204045 | 6 | 6 | |||
6 | PFCF11E | 203980 | 60 | 60 | |||
7 | PFCF11E | 204085 | 10 | 10 | |||
8 | PBTF12 | 204125 | 10 | ||||
9 | PBTF12 | 204125 | 20 | ||||
10 | PBTF12 | 204125 | 50 | ||||
11 | PBTF12 | 204125 | 20 | 100 | |||
12 | PBTF12 | 204127 | 10 | 10 | |||
13 | PFCF11E | 203134 | 45 | ||||
14 | PFCF11E | 203134 | 15 | 60 | |||
15 | PBB12(JE1) | 204136 | 500 | 500 | |||
16 | PBTF12 | 204136 | 10 | 10 | |||
17 | PBB12(JE1) | 204225 | 500 | 500 | |||
18 | PBB12(JE1) | 204229 | 500 | 500 | |||
19 | PFCF11E | 204284 | 10 | 10 | |||
20 | PBTF12 | 204278 | 52 | 52 | |||
21 | TGB | 204278 | 7 | 7 | |||
22 | PBB12(MKM1) | 204402 | 30 | ||||
23 | PBB12(MKM1) | 204402 | 300 | 330 | |||
24 | PFCF11E | 204450 | 2 | 2 | |||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E2:E24 | E2 | =IF(COUNTIFS($A$2:$A$24,A2,$B$2:$B$24,B2)=COUNTIFS($A$2:$A2,A2,$B$2:$B2,B2), SUMPRODUCT(($A$2:$A$24=$A2)*($B$2:$B$24=$B2)*($D$2:$D$24)),"") |