Hey, guys,
Could you please give me a hand with something. I am making a media plan and want to calculate the spend per week. The way it works is: I have multiple channels, spread by weeks and each channel has a budget. The days when I communicate through that channel, I manually color the cell (please see attached photo for the colored plan).
What I have is:
Dim Result() As Variant
ReDim Result(1 To 1, 1 To CellRange.Cells.Count)
Dim i As Integer
i = 1
For Each rCell In CellRange
Result(1, i) = (rCell.Interior.ColorIndex <> xlNone)
i = i + 1
Next rCell
IsCellColored = Result
End Function
The desired outcome:
Could you please give me a hand with something. I am making a media plan and want to calculate the spend per week. The way it works is: I have multiple channels, spread by weeks and each channel has a budget. The days when I communicate through that channel, I manually color the cell (please see attached photo for the colored plan).
What I have is:
- With the kind help of @Fluff, the VBA Code for the colored cells
Dim Result() As Variant
ReDim Result(1 To 1, 1 To CellRange.Cells.Count)
Dim i As Integer
i = 1
For Each rCell In CellRange
Result(1, i) = (rCell.Interior.ColorIndex <> xlNone)
i = i + 1
Next rCell
IsCellColored = Result
End Function
The desired outcome:
- Budget per week, for cells B11, C11, D11. Now they are added manually. What it should be is something the likes of: B11 = SUM of IF IsCellColored(B5:B10), E5:E10 / F5:F10 * C4. Basically, the SUM of (BUDGET / active days * days in the week) for all the active channels in that week, but of course, only for the colored cells.
MAY | BUDGET | Active Days | |||
Week | 15-21 | 22-28 | 29-31 | ||
DAYS | 7 | 7 | 3 | ||
Search | € 8,000 | 17 | |||
Google Display | € 6,000 | 14 | |||
€ 3,500 | 7 | ||||
Insta | € 7,000 | 10 | |||
TikTok | € 3,500 | 10 | |||
OOH | 0 | ||||
BUDGET PER WEEK | € 12,244 | € 11,194 | € 4,562 | € 28,000 |