samilynn
Board Regular
- Joined
- Jun 24, 2003
- Messages
- 171
- Office Version
- 2016
- Platform
- Windows
I'm working on a macro with a lot of steps for a file that needs to be recreated on a regular basis.
Is it possible to have the macro modify the range in the formula each time, based on how many rows are populated in the file? (the spreadsheet doesn't always have 738 rows of data).
The formula gives the total quantity per product, without having to use Subtotal.
Thank you!
Samantha
Is it possible to have the macro modify the range in the formula each time, based on how many rows are populated in the file? (the spreadsheet doesn't always have 738 rows of data).
The formula gives the total quantity per product, without having to use Subtotal.
Thank you!
Samantha
Excel 2010 64 bit | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | PROD | WHSE | QTY | COST | TOTAL QTY | |||
2 | AB5314 | Whse: 1 | 5,000 | $1.95 | 15,000 | IF(COUNTIF($A$2:A2,A2)=1,SUMIF($A$2:$A$738,A2,$C$2:$C$738),"") | ||
3 | AB5314 | Whse: 2 | 10,000 | $1.97 | ||||
4 | SQ5577 | Whse: 1 | 29 | $317.43 | 41 | |||
5 | SQ5577 | Whse: 2 | 12 | $317.43 | ||||
QTY |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E2 | =IF(COUNTIF($A$2:A2,A2)=1,SUMIF($A$2:$A$738,A2,$C$2:$C$738),"") | |
E3 | =IF(COUNTIF($A$2:A3,A3)=1,SUMIF($A$2:$A$738,A3,$C$2:$C$738),"") | |
E4 | =IF(COUNTIF($A$2:A4,A4)=1,SUMIF($A$2:$A$738,A4,$C$2:$C$738),"") | |
E5 | =IF(COUNTIF($A$2:A5,A5)=1,SUMIF($A$2:$A$738,A5,$C$2:$C$738),"") |