Use a named range/table to lookup names in a countifs formula

Nixxy

New Member
Joined
Jun 20, 2019
Messages
1
Hi,

Hope someone can help.

I am trying to create a formula to lookup data in an input sheet and create a summary of key info and gap analysis.

the table looks simply as follows:

[TABLE="width: 300"]
<tbody>[TR]
[TD][TABLE="width: 270"]
<tbody>[TR]
[TD="colspan: 4"]Input Table[/TD]
[/TR]
[TR]
[TD]REF[/TD]
[TD]Region[/TD]
[TD]PM[/TD]
[TD]Wave[/TD]
[/TR]
[TR]
[TD]Ref 1[/TD]
[TD]Region 1[/TD]
[TD]PM1[/TD]
[TD]Wave 1[/TD]
[/TR]
[TR]
[TD]Ref 2[/TD]
[TD]Region 1[/TD]
[TD][/TD]
[TD]Wave 1[/TD]
[/TR]
[TR]
[TD]Ref 3[/TD]
[TD]Region 2[/TD]
[TD]PM3[/TD]
[TD]Wave 2[/TD]
[/TR]
[TR]
[TD]Ref 4[/TD]
[TD]Region 2[/TD]
[TD]PM4[/TD]
[TD]Wave 1[/TD]
[/TR]
[TR]
[TD]Ref 5[/TD]
[TD]Region 3[/TD]
[TD]PM5[/TD]
[TD]Wave 3[/TD]
[/TR]
[TR]
[TD]Ref 6[/TD]
[TD]Region 3[/TD]
[TD]PM1[/TD]
[TD]Wave 2[/TD]
[/TR]
[TR]
[TD]Ref 7[/TD]
[TD]Region 4[/TD]
[TD]PM2[/TD]
[TD]Wave 3[/TD]
[/TR]
[TR]
[TD]Ref 8[/TD]
[TD]Region 4[/TD]
[TD]PM1[/TD]
[TD]Wave 1[/TD]
[/TR]
[TR]
[TD]Ref 9[/TD]
[TD]Region 5[/TD]
[TD]PM4[/TD]
[TD]Wave 1[/TD]
[/TR]
[TR]
[TD]Ref 10[/TD]
[TD]Region 5[/TD]
[TD]PM5[/TD]
[TD]Wave 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 250"]
<tbody>[TR]
[TD][TABLE="width: 169"]
<tbody>[TR]
[TD="colspan: 2"]Output table[/TD]
[/TR]
[TR]
[TD]Region[/TD]
[TD]No PM[/TD]
[/TR]
[TR]
[TD]Region 1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Region 2[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Region 3[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Region 4[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Region 5[/TD]
[TD="align: right"]2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

the formula I am using is:
=COUNTIFS($C$30:$C$39,"<>",$D$30:$D$39,$H30,$E$30:$E$39,{"PM1","PM2","PM3","PM4","PM5"},$F$30:$F$39,"Wave 1")+COUNTIFS($C$30:$C$39,"<>",$D$30:$D$39,$H30,$E$30:$E$39,{"PM1","PM2","PM3","PM4","PM5"},$F$30:$F$39,"Wave 2")

Is there a way to combine all of the PMs into a table and count any person which is in that table/named range against the PM column in the input sheet? This means I can just add the name of a new PM to the table rather than having to alter the formula.

Thanks in advance for any help.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I give you 2 options:


<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:76.04px;" /><col style="width:96px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:101.7px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td><td >H</td><td >I</td><td >J</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >28</td><td style="background-color:#fafafa; font-family:Verdana; ">Input Table</td><td style="background-color:#fafafa; font-family:Verdana; "> </td><td style="background-color:#fafafa; font-family:Verdana; "> </td><td style="background-color:#fafafa; font-family:Verdana; "> </td><td > </td><td style="background-color:#fafafa; font-family:Verdana; ">Output table</td><td style="background-color:#fafafa; font-family:Verdana; "> </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >29</td><td style="background-color:#fafafa; font-family:Verdana; ">REF</td><td style="background-color:#fafafa; font-family:Verdana; ">Region</td><td style="background-color:#fafafa; font-family:Verdana; ">PM</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave</td><td > </td><td style="background-color:#fafafa; font-family:Verdana; ">Region</td><td style="background-color:#fafafa; font-family:Verdana; ">No PM</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >30</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 1</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 1</td><td style="background-color:#fafafa; font-family:Verdana; ">PM1</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 1</td><td > </td><td style="background-color:#fafafa; font-family:Verdana; ">Region 1</td><td style="text-align:right; ">1</td><td style="text-align:right; ">1</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >31</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 2</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 1</td><td style="background-color:#fafafa; font-family:Verdana; "> </td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 1</td><td > </td><td style="background-color:#fafafa; font-family:Verdana; ">Region 2</td><td style="text-align:right; ">2</td><td style="text-align:right; ">2</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >32</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 3</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 2</td><td style="background-color:#fafafa; font-family:Verdana; ">PM3</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 2</td><td > </td><td style="background-color:#fafafa; font-family:Verdana; ">Region 3</td><td style="text-align:right; ">1</td><td style="text-align:right; ">1</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >33</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 4</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 2</td><td style="background-color:#fafafa; font-family:Verdana; ">PM4</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 1</td><td > </td><td style="background-color:#fafafa; font-family:Verdana; ">Region 4</td><td style="text-align:right; ">1</td><td style="text-align:right; ">1</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >34</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 5</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 3</td><td style="background-color:#fafafa; font-family:Verdana; ">PM5</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 3</td><td > </td><td style="background-color:#fafafa; font-family:Verdana; ">Region 5</td><td style="text-align:right; ">2</td><td style="text-align:right; ">2</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >35</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 6</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 3</td><td style="background-color:#fafafa; font-family:Verdana; ">PM1</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 2</td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >36</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 7</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 4</td><td style="background-color:#fafafa; font-family:Verdana; ">PM2</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 3</td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >37</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 8</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 4</td><td style="background-color:#fafafa; font-family:Verdana; ">PM1</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 1</td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >38</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 9</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 5</td><td style="background-color:#fafafa; font-family:Verdana; ">PM4</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 1</td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >39</td><td style="background-color:#fafafa; font-family:Verdana; ">Ref 10</td><td style="background-color:#fafafa; font-family:Verdana; ">Region 5</td><td style="background-color:#fafafa; font-family:Verdana; ">PM5</td><td style="background-color:#fafafa; font-family:Verdana; ">Wave 2</td><td > </td><td > </td><td > </td><td > </td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >I30</td><td >=COUNTIFS($C$30:$C$39,"<>",$D$30:$D$39,$H30,$E$30:$E$39,"PM*",$F$30:$F$39,"Wave 1")+COUNTIFS($C$30:$C$39,"<>",$D$30:$D$39,$H30,$E$30:$E$39,"PM*",$F$30:$F$39,"Wave 2")</td></tr><tr><td >J30</td><td >=SUMPRODUCT(($C$30:$C$39<>"")*($D$30:$D$39=$H30)*(LEFT($E$30:$E$39,2)="PM")*(($F$30:$F$39="Wave 1")+($F$30:$F$39="Wave 2")))</td></tr></table></td></tr></table>
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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