Silent_John
New Member
- Joined
- Sep 2, 2009
- Messages
- 17
So through combining several formulas I now have this amazing formula that allows the user to have a criteria for extracting data. When they put this in, the formula pops out a sorted list of the data including the data from other columns that go along with item (Last, First, DOB). Which field the data is sorted by can be chosen by the user. My only problem is that duplicates ruin the whole thing. So, I am asking how I could make this formula work with duplicates (or a new formula altogether if it accomplished the same thing).
So if you open my linked example sheet everything works grand. However, that's because one name is Xavier and one is Xavier2. If you change "Xavier2" to just "Xavier" this creates a duplicate and if we are sorting by first name this breaks the formula. Not only is one Xavier missing from the list, also the information (last name and DOB) for the other people is no longer accurate.
I have the formula below, a link to the example sheet, an explanation of key cells below, and a screenshot below. Thank you so much for any help.
So, here is my array formula (from F6 and copied into F6:H11):
{=INDEX(INDIRECT(F$5), MATCH(MIN(IF((COUNTIF(F$5:F5, INDIRECT(F$5))=0)*(COUNTIF($F$2,Division)), 1, MAX((COUNTIF(INDIRECT($G$2), "<"&INDIRECT($G$2))+1)*2))*(COUNTIF(INDIRECT($G$2), "<"&INDIRECT($G$2))+1)), IF(COUNTIF($F$2,Division),COUNTIF(INDIRECT($G$2), "<"&INDIRECT($G$2))+1,""), 0))}
F$5 (G$5 and H$5) : Contains the title of the extracted data which, through indirect is able to reference the named range om the left (First, Last, DOB respectively in our case)
$F$2 : The criteria used to extract certain data. In this case the user puts in a certain division
"Division": Named range containing the field that contains all the divisions.
$G$2: Contains in text the field the user wants to sort the data by. With indirect it is used to get the named range of the chosen sort range.
Some constraints:
-Excel 2007
-No macros
-The solution needs to be contained to one formula as it currently is. A helper column cannot be created.
-Of course the usual is true: I am needing to do this in excel and not a database. Also "autosort" and filters are not an option.
So if you open my linked example sheet everything works grand. However, that's because one name is Xavier and one is Xavier2. If you change "Xavier2" to just "Xavier" this creates a duplicate and if we are sorting by first name this breaks the formula. Not only is one Xavier missing from the list, also the information (last name and DOB) for the other people is no longer accurate.
I have the formula below, a link to the example sheet, an explanation of key cells below, and a screenshot below. Thank you so much for any help.
So, here is my array formula (from F6 and copied into F6:H11):
{=INDEX(INDIRECT(F$5), MATCH(MIN(IF((COUNTIF(F$5:F5, INDIRECT(F$5))=0)*(COUNTIF($F$2,Division)), 1, MAX((COUNTIF(INDIRECT($G$2), "<"&INDIRECT($G$2))+1)*2))*(COUNTIF(INDIRECT($G$2), "<"&INDIRECT($G$2))+1)), IF(COUNTIF($F$2,Division),COUNTIF(INDIRECT($G$2), "<"&INDIRECT($G$2))+1,""), 0))}

F$5 (G$5 and H$5) : Contains the title of the extracted data which, through indirect is able to reference the named range om the left (First, Last, DOB respectively in our case)
$F$2 : The criteria used to extract certain data. In this case the user puts in a certain division
"Division": Named range containing the field that contains all the divisions.
$G$2: Contains in text the field the user wants to sort the data by. With indirect it is used to get the named range of the chosen sort range.
Some constraints:
-Excel 2007
-No macros
-The solution needs to be contained to one formula as it currently is. A helper column cannot be created.
-Of course the usual is true: I am needing to do this in excel and not a database. Also "autosort" and filters are not an option.
Last edited: