Hey there Excel Wizards, got a tricky problem here I couldn't find a solution for. I'm using a data set for campaign spend on a daily basis. In short, I need to pull in the budget of each campaign to each of my rows in my data set. I can match on campaign and advertiser name without a problem, but because there can be multiple flights of a campaign I also need to match on a date. Tricky thing is the majority of dates will not be an exact match.
Below are two screenshots of my sheet; one is a table with my data and calculated values (column H, highlighted in orange, is where my issue is), the other is where the flight data lives in Campaign Flights!B6:F1007. If it works properly, the value in cell H2 should be $10,000 and H3 should be $15,000. The formula I have been using in column H is as follows:
=IFERROR(IF(ISBLANK([@Advertiser]),"",INDEX('Campaign Flights'!$B$6:$F$1007,MATCH(1,([@Advertiser]='Campaign Flights'!$B$6:$B$1007)*([@Campaign]='Campaign Flights'!$C$6:$C$1007)*([@Date]-MINIFS('Campaign Flights'!$E$6:$E$1007,[@Advertiser],'Campaign Flights'!$B$6:$B$1007,[@Campaign],'Campaign Flights'!$C$6:$C$1007,[@Date],">="&'Campaign Flights'!$E$6:$E$1007)+1=[@Date]-'Campaign Flights'!$E$6:$E$1007+1),0),3)),0)
The key in this equation is the MINIFS() I'm using since one of my ifs is referencing a range of cells instead of a singular cell or value. For reference, before I tried index matching using date I was receiving the correct values using this formula:
=IFERROR(IF(ISBLANK([@Advertiser]),"",INDEX('Campaign Flights'!$B$6:$F$1007,MATCH(1,([@Advertiser]='Campaign Flights'!$B$6:$B$1007)*([@Campaign]='Campaign Flights'!$C$6:$C$1007),0),3)),0)
Multiple campaign flights mess this up pretty bad. Open to ideas/thoughts/alternative solutions!
Below are two screenshots of my sheet; one is a table with my data and calculated values (column H, highlighted in orange, is where my issue is), the other is where the flight data lives in Campaign Flights!B6:F1007. If it works properly, the value in cell H2 should be $10,000 and H3 should be $15,000. The formula I have been using in column H is as follows:
=IFERROR(IF(ISBLANK([@Advertiser]),"",INDEX('Campaign Flights'!$B$6:$F$1007,MATCH(1,([@Advertiser]='Campaign Flights'!$B$6:$B$1007)*([@Campaign]='Campaign Flights'!$C$6:$C$1007)*([@Date]-MINIFS('Campaign Flights'!$E$6:$E$1007,[@Advertiser],'Campaign Flights'!$B$6:$B$1007,[@Campaign],'Campaign Flights'!$C$6:$C$1007,[@Date],">="&'Campaign Flights'!$E$6:$E$1007)+1=[@Date]-'Campaign Flights'!$E$6:$E$1007+1),0),3)),0)
The key in this equation is the MINIFS() I'm using since one of my ifs is referencing a range of cells instead of a singular cell or value. For reference, before I tried index matching using date I was receiving the correct values using this formula:
=IFERROR(IF(ISBLANK([@Advertiser]),"",INDEX('Campaign Flights'!$B$6:$F$1007,MATCH(1,([@Advertiser]='Campaign Flights'!$B$6:$B$1007)*([@Campaign]='Campaign Flights'!$C$6:$C$1007),0),3)),0)
Multiple campaign flights mess this up pretty bad. Open to ideas/thoughts/alternative solutions!