RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 810
- Office Version
- 365
- Platform
- Windows
Brochure_Region | OptIn_NH_LandMail | Last_Booked | Last_Booked | FamilyFun | FamilyFun | UK | UK | Sports | Sports | Events | Events | EU | EU | Showtime | Showtime | OptIn_ThirdParty | OptIn_DirectEmail | Results |
<>0 | <>0 | >=0 | <=1000000 | >=1 | <=10000 | |||||||||||||
<>0 | <>0 | >=0 | <=1000000 | >=1 | <=10000 | |||||||||||||
<>0 | <>0 | >=0 | <=1000000 | >=1 | <=10000 |
In a previous formula, I helpfully had the name of the criteria in the "OptIn_DirectEmail" column (Column R). That formula is below:
VBA Code:
Cells(ActiveCell.Row, "S").FormulaR1C1 = "=SUMPRODUCT(SUBTOTAL(3,OFFSET(DataFeed!R2C35:R" & LastrowDF & "C35,ROW(DataFeed!R2C35:R" & LastrowDF & "C35)-MIN(ROW(DataFeed!R2C35:R" & LastrowDF & "C35)),,1))*(DataFeed!R2C35:R" & LastrowDF & "C35=""" & Cells(ActiveCell.Row, "R").Value & """))"
That doesn't exist in the above table.
What this formula did is return the value of active cell column R inside quote marks, so FamilyFun becomes "FamilyFun"
In the final column, Results, for each row, I need to have the same long formula as above, but in that last bracket it needs to find the name of the column header where the row isn't blank.
For example, in row 2 the formula should be
VBA Code:
Cells(ActiveCell.Row, "S").FormulaR1C1 = "=SUMPRODUCT(SUBTOTAL(3,OFFSET(DataFeed!R2C35:R" & LastrowDF & "C35,ROW(DataFeed!R2C35:R" & LastrowDF & "C35)-MIN(ROW(DataFeed!R2C35:R" & LastrowDF & "C35)),,1))*(DataFeed!R2C35:R" & LastrowDF & "C35=""FamilyFun""))"
and in row 3,
VBA Code:
Cells(ActiveCell.Row, "S").FormulaR1C1 = "=SUMPRODUCT(SUBTOTAL(3,OFFSET(DataFeed!R2C35:R" & LastrowDF & "C35,ROW(DataFeed!R2C35:R" & LastrowDF & "C35)-MIN(ROW(DataFeed!R2C35:R" & LastrowDF & "C35)),,1))*(DataFeed!R2C35:R" & LastrowDF & "C35=""Events""))"
But instead of doing that cells(activecell.row, "R").value guff, I need to see that on that row, FamilyFun has the criteria applied, so it should be FamilyFun. On the row below, it's Events, so the next formula down would have Events, and so on.
Can you think of a way to do this? Meanwhile I'll keep thinking about it, but all I can think of is doing some kind of index-match where the result is non-blank...