Advanced Lookup Formula or Macro

LearnVBA83

Board Regular
Joined
Dec 1, 2016
Messages
109
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm having trouble trying to automate a manual process by which I need to compare data from 3 separate reports using a contract ID as the unique identifier. The problem is two of the reports have the Contract ID with other data (Figure 1) merged in Columns K-L. Also, the amount I need to return is the total amount which for that Contract ID could be multiple rows (Figure 2). I do think the first report always has the row of the total amount I need labeled as " In-Stream Media Summary" and the other report has it labeled as "Targeted Media Summary" . The totals are also always in column H.

Figure 1 - Contract ID is merged with other words/numbers in A229 to L229. I know it doesn't looked merged using the HTML snipit below but they are (Worksheet Tab is called Mock Company)

Excel 2010
ABCDEFGHIJKL
228Campaign: NAPA 2017 Upfront Digital Audio Streaming (ID: 135173)
229Contract ID: 1292817 Advertiser: NAPA AUTO PARTS (ID: 12147)
230In-Stream Ad NameAd DescriptionAd Cart IdStationStation DMAFlightsImpPlaysClicksCTR(%)Revenue
2315.29-6.4 Stream:30/:60 audio streaming ad can be accompanied by an adjacent 300x250 banner18152817WEPN-FMNew York NY05/29/17-06/04/1759,41565.1N/AN/A199.99
2326.5-6.11 Stream:30/:60 audio streaming ad can be accompanied by an adjacent 300x250 banner18151137WEPN-FMNew York NY06/05/17-06/11/17116,735102.0N/AN/A392.93
2336.12-6.18 Stream:30/:60 audio streaming ad can be accompanied by an adjacent 300x250 banner18152937WEPN-FMNew York NY06/12/17-06/18/17120,092126.2N/AN/A404.23

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Mock Company



Figure 2 - The number of rows that make up the totals in Column H that I need to return with the lookup varies by Contract. A ungique identifier could be "In-Stream Media Summary" (merged cells A220 - G220) for the Mock Company report.

Excel 2010
ABCDEFGHIJKL
204Contract ID: 1472457 Advertiser: LA QUINTA INNS (ID: 21207)
205In-Stream Ad NameAd DescriptionAd Cart IdStationStation DMAFlightsImpPlaysClicksCTR(%)Revenue
2066.5-6.25 StreamTargeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
28419777WEPN-FMNew York NY06/05/17-06/25/17349,853392.5N/AN/A1,195.45
2076.26-7.2Targeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
22827297WEPN-FMNew York NY06/26/17-07/02/17117,23987.0N/AN/A400.61
2086.5-6.25 StreamTargeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
28419777WMVP-AMChicago IL06/05/17-06/25/17279,387373.6N/AN/A954.67
2096.26-7.2Targeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
22827297WMVP-AMChicago IL06/26/17-07/02/17112,775103.6N/AN/A385.35
2106.5-6.25 StreamTargeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
28419777Mock CompanyRadioNetworkHartford & New Haven CT06/05/17-06/25/173,752,390466.0N/AN/A12,821.92
2116.26-7.2Targeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
22827297Mock CompanyRadioNetworkHartford & New Haven CT06/26/17-07/02/171,303,978118.5N/AN/A4,455.69
2126.5-6.25 StreamTargeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
28419777KSPN-AMLos Angeles CA06/05/17-06/25/17262,996364.2N/AN/A898.66
2136.26-7.2Targeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
22827297KSPN-AMLos Angeles CA06/26/17-07/02/17111,336103.8N/AN/A380.44
2146.5-6.25 StreamTargeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
28419777SideChannel1No/Unrated Market06/05/17-06/25/1711,222255.8N/AN/A38.35
2156.26-7.2Targeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
22827297SideChannel1No/Unrated Market06/26/17-07/02/1737336.5N/AN/A1.27
2166.5-6.25 StreamTargeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
28419777PaulFinebaumNo/Unrated Market06/05/17-06/25/1732,39470.1N/AN/A110.69
2176.26-7.2Targeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
22827297PaulFinebaumNo/Unrated Market06/26/17-07/02/177,17316.3N/AN/A24.51
2186.5-6.25 StreamTargeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
28419777SideChannel2No/Unrated Market06/05/17-06/25/17276197.8N/AN/A0.94
2196.26-7.2Targeted Impression: Impression based opportunity sold to multiple advertisers at various impression levels and flights.
This :30/:60 audio streaming is NOT AD SERVED.This :30/:60 audio streaming ad is accompanied by an adjacent 300x250 and is not served by DART.
22827297SideChannel2No/Unrated Market06/26/17-07/02/1712458.3N/AN/A0.42
220In-Stream Media Summary6,341,5162,644N/AN/A21,668.96

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Mock Company



Figure 3 is the other report in worksheet tab called UnCast. It's the same basic report except the totals are called "Targeted Media Summary" merged in A23 - G23

Excel 2010
ABCDEFGHIJKL
16Contract ID: 1308657 Advertiser: N/A (ID: N/A)
17Targeted Ad NameAd DescriptionAd Cart IdStationStation DMAFlightsImpPlaysClicksCTR(%)Revenue
186.1-6.30 Pre-Roll - Baseball Tonight UnCast Rotational_3This UnCast ad is NOT AD SERVED by DART.19742937PodCenter: Baseball TonightNo/Unrated Market06/01/17-06/30/1723,7840N/AN/A242.60
197.1-7.31 Pre-Roll - Baseball Tonight UnCast Rotational_4This UnCast ad is NOT AD SERVED by DART.19743057PodCenter: Baseball TonightNo/Unrated Market07/01/17-07/31/171,7730N/AN/A18.08
206.1-6.30 Pre-Roll - Fantasy Focus Baseball UnCast_2This UnCast ad is NOT AD SERVED by DART.19743777PodCenter: Fantasy Focus BaseballNo/Unrated Market06/01/17-06/30/1735,3810N/AN/A360.89
217.1-7.31 Pre-Roll - Fantasy Focus Baseball UnCast_3This UnCast ad is NOT AD SERVED by DART.19743897PodCenter: Fantasy Focus BaseballNo/Unrated Market07/01/17-07/31/171,1710N/AN/A11.94
226.5-6.30 Pre-Roll - The Lowe Post UnCast Rotational (copy 2) (copy 2)This UnCast ad is NOT AD SERVED by DART.19668417PodCenter: The Lowe PostNo/Unrated Market06/05/17-06/30/1752,9100N/AN/A539.68
23Targeted Media Summary115,0190N/AN/A1,173.19

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
UnCast




Figure 4 is the report i'm working from that I want to input the lookup or macro in rows N, O, P. Column B is the originating lookup contract ID.

Excel 2010
ABCDEFGHIJKLMNOP
9
10ContractRevDFP OrderStart DateEnd DateProposal TypeBill SourceCurrencyBilling CoContract AmountContract ImpressionsContract Delv ImpsMock CompanyPODCASTDIFFERENCE
11808017448084341704/01/201706/04/2017RevenueActualsU.S. DollarMock Company21,862.001,399,13338,05738,0570
121162857246572965703/27/201706/18/2017Revenue - RadioActualsU.S. DollarMock Company31,149.007,240,239930,182745,593184,5890
131163097146572917706/26/201709/17/2017Revenue - RadioActualsU.S. DollarMock Company31,149.007,240,239916,840772,807144,0330
1411683771148155573701/01/201712/31/2017RevenueActualsU.S. DollarMock Company334,750.0041,512,233162,061162,0610

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Digital Contract & Delivery Aud

Worksheet Formulas
CellFormula
P11=+M11-N11-O11
O12=+UnCast!H872
P12=+M12-N12-O12
O13=+UnCast!H1874
P13=+M13-N13-O13
O14=+UnCast!H560
P14=+M14-N14-O14
N11=+'Mock Company'!H20
N12=+'Mock Company'!H409
N13=+'Mock Company'!H1008

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Note: The html screenshots are just examples. The first report is usually less that 100 lines (contract ID's), but the two reports i'm comparing to (Figure 1,2, and 3) have all of the details so they all have several thousand lines. Right now i'm having to look at a contract and use control find to match the contract and manually input the amount.

Please let me know if you have any suggestions or solutions!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,214,965
Messages
6,122,499
Members
449,089
Latest member
Raviguru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top