using vlookup in the range of a sumif formula

gbswiss

New Member
Joined
Jan 31, 2018
Messages
2
I need to create a report that looks up data provided on another worksheet and spits out the sum of all trades maturing in less than or equal to 12 months. So the data looks like this:

Worksheet A
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Portfolio[/TD]
[TD]Maturing < 1yr[/TD]
[/TR]
[TR]
[TD]ABC123[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]DEF345[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]GHI678[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Worksheet B
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Portfolio[/TD]
[TD]Market Value[/TD]
[TD]Maturity[/TD]
[/TR]
[TR]
[TD]ABC123[/TD]
[TD]100[/TD]
[TD]6/15/2019[/TD]
[/TR]
[TR]
[TD]ABC123[/TD]
[TD]200[/TD]
[TD]7/31/2019[/TD]
[/TR]
[TR]
[TD]ABC123[/TD]
[TD]100[/TD]
[TD]2/15/2018[/TD]
[/TR]
[TR]
[TD]DEF345[/TD]
[TD]600[/TD]
[TD]2/28/2019[/TD]
[/TR]
[TR]
[TD]DEF345[/TD]
[TD]900[/TD]
[TD]3/15/2018[/TD]
[/TR]
[TR]
[TD]DEF345[/TD]
[TD]600[/TD]
[TD]2/1/2018 (today)[/TD]
[/TR]
[TR]
[TD]GHI678[/TD]
[TD]400[/TD]
[TD]5/31/2018[/TD]
[/TR]
[TR]
[TD]GHI678[/TD]
[TD]700[/TD]
[TD]8/1/2019[/TD]
[/TR]
[TR]
[TD]GHI678[/TD]
[TD]800[/TD]
[TD]11/30/2019[/TD]
[/TR]
[TR]
[TD]GHI678[/TD]
[TD]100[/TD]
[TD]2/1/2019
(1 yr from today)[/TD]
[/TR]
</tbody>[/TABLE]

The result should look like this:

Worksheet A

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Portfolio[/TD]
[TD]Maturing < 1yr[/TD]
[/TR]
[TR]
[TD]ABC123[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]DEF345[/TD]
[TD]1,500[/TD]
[/TR]
[TR]
[TD]GHI678[/TD]
[TD]500[/TD]
[/TR]
</tbody>[/TABLE]

I created a SumIf formula as follows, but it adds up all the maturities for all of the portfolios instead of matching it the portfolio the vlookup requires

=SUMIF(IF(A2=VLOOKUP(A2,'Worksheet B'!A2:C10,1),'Worksheet B'!C2:C10),"<=" & NOW()+365,'Worksheet B'!B2:B10)

The formula without vlookup works fine as long as I have the data all in one worksheet AND I am only referencing one row: '=SUMIF(IF(A2=A10,C10),"<=" & NOW()+365,B10:B10)

The other concern I have is how will excel know to add the entire column pertaining to ABC123 and not just pick one row?

Thanks for the help

GBSwiss
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Try


Excel 2010
AB
1PortfolioMaturing < 1yr
2ABC123100
3DEF3451500
4GHI678500
Sheet7
Cell Formulas
RangeFormula
B2=SUMIFS(Sheet8!$B$2:$B$11,Sheet8!$A$2:$A$11,A2,Sheet8!$C$2:$C$11,"<"&NOW()+365)
B3=SUMIFS(Sheet8!$B$2:$B$11,Sheet8!$A$2:$A$11,A3,Sheet8!$C$2:$C$11,"<"&NOW()+365)
B4=SUMIFS(Sheet8!$B$2:$B$11,Sheet8!$A$2:$A$11,A4,Sheet8!$C$2:$C$11,"<"&NOW()+365)



Excel 2010
ABC
1PortfolioMarket ValueMaturity
2ABC1231006/15/2019
3ABC1232007/31/2019
4ABC1231002/15/2018
5DEF3456002/28/2019
6DEF3459003/15/2018
7DEF3456002/1/2018
8GHI6784005/31/2018
9GHI6787008/1/2019
10GHI67880011/30/2019
11GHI6781002/1/2019
Sheet8
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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