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
PortfolioMaturing < 1yr
ABC123
DEF345
GHI678

<tbody>
</tbody>

Worksheet B
PortfolioMarket ValueMaturity
ABC1231006/15/2019
ABC1232007/31/2019
ABC1231002/15/2018
DEF3456002/28/2019
DEF3459003/15/2018
DEF3456002/1/2018 (today)
GHI6784005/31/2018
GHI6787008/1/2019
GHI67880011/30/2019
GHI6781002/1/2019
(1 yr from today)

<tbody>
</tbody>

The result should look like this:

Worksheet A

PortfolioMaturing < 1yr
ABC123100
DEF3451,500
GHI678500

<tbody>
</tbody>

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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,215,232
Messages
6,123,768
Members
449,122
Latest member
sampak88

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