bmiller603
New Member
- Joined
- Oct 1, 2019
- Messages
- 2
Hello,
I'm working on trying to auto-fill a sales table I have by inserting either formulas into certain cells or creating a VBA macro. I'm comfortable working with both so either method to solve this problem would be great. I've recreated the table below since I didn't see a way to attach my workbook.
Each month I enter the number of sales in column B. The total sales are then calculated using the sum function in column C. Columns D through G are what I'm trying to automate. These columns represent the the number of sales out of the total volume in that bracket. For example the month of April has 4,728 sales before the total number of sales is over 100,000. The rest of the sales for that month (50,464) are now placed in the 101-200k category. This happens again in May, 49,536 sales take place in the 101-200k bracket before the rest of the sales for that month move into the 201-300k bracket. These brackets are later used to determine discount rates. The tricky part is that the bracket changes can happen in any month. Theoretically if there were 340,000 sales in January then there would be 100,000 in brackets D, E, & F and 40,000 in bracket G. This is what I'm having a hard time wrapping my head around without writing a gigantic nested if statement.
Any help is appreciated. Thanks for your time.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Month[/TD]
[TD]Sales # per month[/TD]
[TD]Total Sales So Far[/TD]
[TD]0-100k[/TD]
[TD]101-200k[/TD]
[TD]201-300k[/TD]
[TD]301-400k[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jan[/TD]
[TD]24,783[/TD]
[TD]24,783[/TD]
[TD]24,783[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Feb[/TD]
[TD]26,843[/TD]
[TD]51,626[/TD]
[TD]26,843[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Mar[/TD]
[TD]43,646[/TD]
[TD]95,272[/TD]
[TD]43,646[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]April[/TD]
[TD]55,192[/TD]
[TD]150,464[/TD]
[TD]4,728[/TD]
[TD]50,464[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]May[/TD]
[TD]79,066[/TD]
[TD]229,530[/TD]
[TD][/TD]
[TD]49,536[/TD]
[TD]29,530[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]June[/TD]
[TD]60,336[/TD]
[TD]289,866[/TD]
[TD][/TD]
[TD][/TD]
[TD]60,336[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]July[/TD]
[TD]64,274[/TD]
[TD]354,140[/TD]
[TD][/TD]
[TD][/TD]
[TD]10,134[/TD]
[TD]54,140[/TD]
[/TR]
</tbody>[/TABLE]
I'm working on trying to auto-fill a sales table I have by inserting either formulas into certain cells or creating a VBA macro. I'm comfortable working with both so either method to solve this problem would be great. I've recreated the table below since I didn't see a way to attach my workbook.
Each month I enter the number of sales in column B. The total sales are then calculated using the sum function in column C. Columns D through G are what I'm trying to automate. These columns represent the the number of sales out of the total volume in that bracket. For example the month of April has 4,728 sales before the total number of sales is over 100,000. The rest of the sales for that month (50,464) are now placed in the 101-200k category. This happens again in May, 49,536 sales take place in the 101-200k bracket before the rest of the sales for that month move into the 201-300k bracket. These brackets are later used to determine discount rates. The tricky part is that the bracket changes can happen in any month. Theoretically if there were 340,000 sales in January then there would be 100,000 in brackets D, E, & F and 40,000 in bracket G. This is what I'm having a hard time wrapping my head around without writing a gigantic nested if statement.
Any help is appreciated. Thanks for your time.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Month[/TD]
[TD]Sales # per month[/TD]
[TD]Total Sales So Far[/TD]
[TD]0-100k[/TD]
[TD]101-200k[/TD]
[TD]201-300k[/TD]
[TD]301-400k[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jan[/TD]
[TD]24,783[/TD]
[TD]24,783[/TD]
[TD]24,783[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Feb[/TD]
[TD]26,843[/TD]
[TD]51,626[/TD]
[TD]26,843[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Mar[/TD]
[TD]43,646[/TD]
[TD]95,272[/TD]
[TD]43,646[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]April[/TD]
[TD]55,192[/TD]
[TD]150,464[/TD]
[TD]4,728[/TD]
[TD]50,464[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]May[/TD]
[TD]79,066[/TD]
[TD]229,530[/TD]
[TD][/TD]
[TD]49,536[/TD]
[TD]29,530[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]June[/TD]
[TD]60,336[/TD]
[TD]289,866[/TD]
[TD][/TD]
[TD][/TD]
[TD]60,336[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]July[/TD]
[TD]64,274[/TD]
[TD]354,140[/TD]
[TD][/TD]
[TD][/TD]
[TD]10,134[/TD]
[TD]54,140[/TD]
[/TR]
</tbody>[/TABLE]