Sum vlookup results using filtered lookup criteria

junbuggle

New Member
Joined
Mar 9, 2021
Messages
13
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hello,

I was hoping someone might be kind enough to help me with a vlookup question.

I'm trying to sum the results of a vlookup, where the lookup criteria are: (1) visible values in a filtered list; and (2) a static value.

So based on the screenshot below, if I filter Table A for George and John, in Row 2 I should get 9 for March, and 11 for April.

So 'George' and 'John' are the visible values in the filtered list. And 'March' and 'April' are static values, and which form a second criterion.

Could someone please help me? I'd be so grateful.

I've looked up combining index, match, and subtotal with vlookups, but am at a complete loss... :(


Thanks!

1626169752946.png
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I cant test a formula on a screen capture and don't have time to retype your data to test this, the theory should be somewhere close but it will probably need some adjustments to work perfectly.
Excel Formula:
=SUMPRODUCT(SUMIFS($C$11:$C$20,$A$11:$A$20,B$3,$B$11:$B$20,IF(SUBTOTAL(3,OFFSET($A$4,ROW($A$4:$A$8)-ROW($A$4),0,1,1)),$A$4:$A$8,"")))
For posting samples it would be preferable if you used XL2BB so that we can copy and paste the data into excel for testing suggestions.
 
Upvote 0
Solution
Oh wow... just wow. It works!

Thank you so much! I really do appreciate it. And I know that this isn't the first time you've been kind enough to respond to my posts. So thank you again :) I'm so grateful.

I would never have thought to use SUMIFS. So I was googling completely on the wrong track. So another reason I'm thankful for you responding.

And thanks for the suggestion about XL2BB. I'm on a work laptop so can't install add-ins, but it might be easier for me to post from my personal laptop in future.


Gratefully yours,

Gav
 
Upvote 0
Hi @jasonb75

I was hoping to ask one further followup question...

I've copied the table into XL2BB and posted here (I didn't realise it was so easy!).

Do you know if there is a way to only pick up distinct values from Table A?

So in this example, (Bob and George) in March should be 6. But because George is counted twice, it's giving me 11. I would like to ignore the duplicate values in Table A.

I tried using UNIQUE to wrap the range in the IF statement (value if true), but that didn't work...


Thanks

Book1
ABC
1Table A
21112
3MarchApril
4Bob
6George
8George
9
10Table B
11MarchBob1
12MarchGeorge5
13MarchHilda7
14MarchJenny2
15MarchJohn4
16AprilBob4
17AprilGeorge4
18AprilHilda5
19AprilJenny2
20AprilJohn7
Sheet1
Cell Formulas
RangeFormula
B2:C2B2=SUMPRODUCT(SUMIFS($C$11:$C$20,$A$11:$A$20,B$3,$B$11:$B$20,IF(SUBTOTAL(3,OFFSET($A$4,ROW($A$4:$A$8)-ROW($A$4),0,1,1)),$A$4:$A$8,"")))
 
Upvote 0
I tried using UNIQUE to wrap the range in the IF statement (value if true), but that didn't work...
You would need to wrap the entire IF, not just the value if true range. By only wrapping the value if true you are creating arrays that are of unequal size which will generate an error in that part of the formula.
Excel Formula:
=SUMPRODUCT(SUMIFS($C$11:$C$20,$A$11:$A$20,B$3,$B$11:$B$20,UNIQUE(IF(SUBTOTAL(3,OFFSET($A$4,ROW($A$4:$A$8)-ROW($A$4),0,1,1)),$A$4:$A$8,""))))
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,872
Members
449,097
Latest member
dbomb1414

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