Extract values, ignore blanks and sort by count, based on name selected from drop down

JJG123

New Member
Joined
Oct 6, 2018
Messages
6
Hello, and thanks for clicking into my posting. I am hoping that someone can offer some guidance with what I am trying to achieve. I am admittedly an excel novice, so I am having a difficult time finding a solution.

The sample data below (beginning from column C) is pulled into a workbook (there are dozens of columns and about 1,000 rows). Except for the true/false column - data in other columns contain repeated values and blanks. My goal is to create a dynamic table in a separate worksheet, based on the data associated with specific manager names. The values should change based on the name selected from a drop down.

Manager names can appear in any of the name columns. To get the manager names into one column, I created a helper column with the following array formula (credit to exceljet website): =INDEX(range2,MATCH(TRUE,COUNTIF(range1,range2)>0,0)) / where range1 = row search range and range 2 = named range 'Managers'


ABCDEF
1Manager (helper)TRUE/FALSEName1NAME2CATEGORYNAME3
2AATRUEAA1
3BBTRUEBB2
4CCTRUECC3
5FALSE1
6AAFALSEAA

<tbody>
</tbody>

Question 1: is there a non-array formula that I can use in the helper column that would achieve the same result?

Question 2: what formula would be required to extract a unique distinct list from the 'Categories' column, sorted by count of occurrence (highest to lowest), and exclude blanks, based on drop down selection (manager name)? This will help me create the rest of the desired table, which will include additional columns/formulas (pivots would not work in my case).

Thank you in advance for any guidance that you can offer.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Welcome to the forum.

Try:

Excel 2012
ABCDEFGHIJKL
1Manager (helper)TRUE/FALSEName1NAME2CATEGORYNAME3ManagersManagerCategoryCount
2AATRUEAA1AAAA12
3BBTRUEBB2CC31
4CCTRUECC3BB
5FALSE1XX
6AAFALSE1AA
7AAAA3

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
A2=IFERROR(INDEX(Range2,LOOKUP(2^20,MATCH(C2:F2,Range2,0))),"")
L2=IF(K2<>"",COUNTIFS($A$2:$A$10,$J$2,$E$2:$E$10,K2),"")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
K2{=IFERROR(INDEX($E$2:$E$10,MODE(IF($A$2:$A$10=$J$2,IF($E$2:$E$10<>"",IF(COUNTIF($K$1:$K1,$E$2:$E$10)=0,MATCH($E$2:$E$10,$E$2:$E$10,0)*{1,1}))))),"")}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Workbook Defined Names
NameRefers To
Range2=Sheet1!$H$2:$H$5

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



The A2 formula doesn't require Control+Shift+Enter, but it still does some internal array processing, I don't think you can get away from that. The E2 formula requires CSE, I don't know how to get around that.

Hope this helps.
 
Upvote 0
Thank you very much for responding. I tried entering the formula referenced in K2, but I keep getting the error message, "You've entered too many arguments for this function."
 
Upvote 0
The formula works for me. Sometimes the formatting distorts the formula, but it appears to be correct. Did you have to change the ranges? If so, what does your formula look like now? What version of Excel do you have?
 
Upvote 0
I am using Excel 2010. It seems I entered the formula incorrectly the first time, as excel now accepts it without error. Although, it is not extracting the values in the way I expected it to (maybe I could have phrased my initial request differently).

The formula extracts some, but not all values from the category field. As I pull the formula down, it is extracting duplicate values. I'd like to extract each distinct value and avoid duplicates, based on the drop down selection.

Notes:
- The main data table (named 'OI') and the desired data table are in different worksheets
- The drop down with the manager names is in cell A4 of the worksheet where desired table will be located
- I entered the formula in cell A53 of the worksheet where desired table will be located

Here's what the formula looks like in my file:
{=IFERROR(INDEX(OI[CATEGORY],MODE(IF(OI[Manager]=$A$4,IF(OI[CATEGORY]<>"",IF(COUNTIF($A$52:$A52,OI[CATEGORY])=0,MATCH(OI[CATEGORY],OI[CATEGORY])*{1,1}))))),"")}
 
Upvote 0
Try this:

=IFERROR(INDEX(OI[CATEGORY],MODE(IF(OI[Manager]=$A$4,IF(OI[CATEGORY]<>"",IF(COUNTIF($A$52:$A52,OI[CATEGORY])=0,MATCH(OI[CATEGORY],OI[CATEGORY],0)*{1,1}))))),"")
with CSE.

That parameter is critical in this case.
 
Upvote 0
That. Was. Beautiful. It works just as I had hoped! Thank you very much for your patience and for sharing your expertise.
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,836
Members
449,096
Latest member
Erald

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