I have a VBA function that I would like to pass a custom range of data (As opposed to a full table column range) only when certain criteria within that table is met. For example:
Table_1 Table_2
A B C A B
1 Policy Data Status | 1 Policy Function
-------------------------- | -------------------
2 AA 25 approved | 2 AA [25, 35]
3 AA 19 unapproved | 3 BB [16]
4 BB 16 approved |
5 CC 27 approved |
6 CC 30 unapproved |
7 AA 35 approved
In Table2, cell B2, I would like to return a range of all Data
values from Table1 where Policy = AA
and Status = approved
. Subsequently, in cell B3 a range of values where Policy = BB
and Status = approved
etc..
Is this possible with a formula?
If you have Office 365 Excel or later you can use TEXTJOIN as an Array Formula:
Being an Array Formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
If you do not have Office 365 Excel or later, here is a UDF that will do what you want:
You would call it similar to SUMIFS:
It only works with columns not rows.