SOLVED

Using Rank Function but with filtering through another criteria as well.

%3CLINGO-SUB%20id%3D%22lingo-sub-1662402%22%20slang%3D%22en-US%22%3EUsing%20Rank%20Function%20but%20with%20filtering%20through%20another%20criteria%20as%20well.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1662402%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20to%20anyone%20who%20can%20help%20and%20thank%20you%20in%20advance%2C%3CBR%20%2F%3EI%20would%20like%20to%20populate%20a%20table%20that%20is%20based%20on%20the%20Rank%20of%201%20criteria%2C%20%22Potential%20Return%22%2C%20but%20then%20also%20specifically%20for%20another%20criteria%20which%20it%20must%20match%2C%26nbsp%3B%20%22GIC%20Industry%22.%20This%20criteria%20includes%20a%20list%20of%26nbsp%3B%20over%2060%20%22GIC%20Industry%22%20labels.%20Examples%20being%20%22Software%22%2C%20%22Chemicals%22%2C%20or%20%22IT%20Services%22.%20My%20issue%20is%20that%20I%20do%20not%20know%20how%20to%20create%20the%20correct%20formula%20so%20that%20Excel%20skips%20the%20top%20ranked%20name%20after%20having%20already%20returned%20it%20once%20and%20move%20on%20to%20the%202nd%2C%203rd%2C%20or%204th-depending%20on%20how%20many%20times%20that%20%22GIC%20Industry%22%20appears%20and%20then%20populate%20correctly.%26nbsp%3B%20I%20have%20attached%20a%20sheet%20which%20has%20the%20raw%20data%20attached%2C%20I%20have%20multiple%20tabs%20so%20for%20purposes%20of%20this%20specific%20issue%20I%20thought%20I%20would%20just%20attached%20the%20view%20I%20am%20trying%20to%20adjust%20and%20the%20source%20from%20where%20I%20am%20pulling%20it%20from.%20In%20column%20B%20the%20%22Symbol%22%2C%20which%20is%20a%20stock%20symbol%2C%20will%20populate%20based%20on%20the%20the%20%22GIC%20Industry%22-Column%20C-%20and%20then%20the%20top%20ranked%20%22Return%20Potential%22%20for%20all%20symbols%20in%20that%20%22GIC%20Industry%22.%26nbsp%3B%20As%20you%20can%20see%20in%20%22Column%20J%22%20I%20have%20all%20symbols%20from%20a%20master%20list%20populated%20and%20Ranked%20based%20entirely%20on%20their%20%22Return%20Potential%22.%26nbsp%3B%20My%20issue%20is%20that%20after%20the%20top%20ranked%20return%20potential%20for%20%22Software%22-cellC4-%20populates%20into%20cellB4-%22BOX%20US%20Equity%22-how%20do%20I%20create%20the%20logic%20so%20that%20if%20%22Software%22%20appears%20again%20below-which%20it%20does%205%20more%20times%20in%20cells%20C5%2C%20C6%2C%20C10%2C%20C14%2C%20C15-%20Excel%20returns%20the%202nd%2C%203rd%2C%204th%2C%205th%2C%20and%206th%20ranked%20names%20in%20the%20%22Software%22%20Industry%20name-Column%20I-%20into%20the%20corresponding%20cells%20in%20Column%20B%3F%20As%20is%20shown%2C%20the%20logic%20I%20used%20kept%20returning%20the%20top%20ranked%20return%20potential%20which%20was%20BOX%20US%20Equity.%20If%20you%20scroll%20down%20to%20cells%20H48%20and%20I48%20you%20can%20see%20that%20%22NET%20US%20Equity%22%20is%20the%202nd%20ranked%20%22Software%22%20name%20by%20%22Return%20Potential%22.%26nbsp%3B%20I%20would%20like%20to%20know%20how%20to%20create%20the%20logic%20that%20would%20make%20%22NET%20US%20Equity%22%20populate%20into%20cell%20B8%20because%20it%20would%20be%20the%202nd%20top%20'Return%20potential%22%20symbol%20in%20the%20specific%20Industry%20of%20Software.%26nbsp%3B%20Thank%20you%20in%20advance%20and%20I%20really%20hope%20I%20explained%20this%20somewhat%20coherently.%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1662402%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1662421%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Rank%20Function%20but%20with%20filtering%20through%20another%20criteria%20as%20well.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1662421%22%20slang%3D%22en-US%22%3E%3CP%3EForgot%20to%20add%20sheet....%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1662690%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Rank%20Function%20but%20with%20filtering%20through%20another%20criteria%20as%20well.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1662690%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F792132%22%20target%3D%22_blank%22%3E%40DCL611%3C%2FA%3E%26nbsp%3BI%20used%20the%20following%20formula%20to%20get%20what%20you%20want%20but%20I'm%20sure%20there%20are%20others%20that%20might%20work%20also.%26nbsp%3B%20This%20does%20assume%20you%20have%20array%20formulas%20in%20your%20version%20of%20excel%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DINDEX(FILTER(H%3AH%2CI%3AI%3DC4)%2CCOUNTIF(C%241%3AC4%2CC4))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EI%20did%20a%20similar%20formula%20for%20column%20E%20(Return%20Potential)%20because%20I%20assume%20you%20will%20need%20that%20too.%26nbsp%3B%20I%20don't%20know%20where%20column%20D%20(Size)%20comes%20from.%26nbsp%3B%20I%20have%20attached%20the%20sheet%20for%20you%20to%20review.%26nbsp%3B%20I%20hope%20that%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1664232%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Rank%20Function%20but%20with%20filtering%20through%20another%20criteria%20as%20well.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1664232%22%20slang%3D%22en-US%22%3E%3CP%3EGood%20Morning%20Mtarler%2C%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20having%20an%20issue%20implanting%20the%20formula.%20So%20without%20trying%20to%20describe%20my%20issue%20in%20a%20wordy%20way%20I%20will%20just%20provide%20the%20sheet%20i%20was%20working%20on%20so%20you%20can%20see%20that%20on%20the%20Portfolio%20Tab%20in%20Column%20AQ(GIC%20Industry)%20that%20input%20is%20coming%20from%20column%20AF%20and%20Column%20AR(Size)%20is%20coming%20from%20Column%20AG(Size).%20What%20I%20am%20attempting%20to%20do%20is%20simply%20replace%20the%20existing%20Symbol%20in%20the%20portfolio%20if%20there%20is%20another%20symbol%20in%20that%20specific%20%22GIC%20Industry%22%20that%20has%20a%20better%20%22Return%20Potential%22%20Column%20AS.%20The%20source%20for%20this%20list%20is%20on%20the%20%22Ranks%22%20tab.%20Columns%20X%2C%20Y%2C%20Z%2C%20and%20AA%20on%20that%20tab%20are%20populated%20with%20the%20entire%20master%20list%20of%20names%20and%20sorted%20by%20Return%20Potential.%20What%20I%20am%20trying%20to%20do%20is%20ask%20whether%20the%20best%20possible%20choice%20of%20a%20particular%20industry%20is%20being%20chosen%20purely%20on%20a%20Potential%20Return%20basis%3F%20I%20hope%20this%20clarifies%20what%20I%20am%20trying%20to%20accomplish%2C%20and%20apologize%20for%20the%20simplification%20of%20the%20original%20scenario%20layout.%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F792132%22%20target%3D%22_blank%22%3E%40DCL611%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1664542%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Rank%20Function%20but%20with%20filtering%20through%20another%20criteria%20as%20well.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1664542%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F792132%22%20target%3D%22_blank%22%3E%40DCL611%3C%2FA%3E%26nbsp%3B%20The%20formula%20appears%20to%20work%20(when%20modified%20for%20those%20column%20locations%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIFERROR(INDEX(FILTER(Ranks!Y%3AY%2CRanks!Z%3AZ%3DAQ8)%2CCOUNTIF(AQ%248%3AAQ8%2CAQ8))%2C%22%20%22)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Enote%20you%20might%20want%20to%20use%20LARGE()%20instead%20of%20INDEX()%20in%20the%20above%20formula%20just%20in%20case%20the%20list%20isn't%20already%20sorted.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello to anyone who can help and thank you in advance,
I would like to populate a table that is based on the Rank of 1 criteria, "Potential Return", but then also specifically for another criteria which it must match,  "GIC Industry". This criteria includes a list of  over 60 "GIC Industry" labels. Examples being "Software", "Chemicals", or "IT Services". My issue is that I do not know how to create the correct formula so that Excel skips the top ranked name after having already returned it once and move on to the 2nd, 3rd, or 4th-depending on how many times that "GIC Industry" appears and then populate correctly.  I have attached a sheet which has the raw data attached, I have multiple tabs so for purposes of this specific issue I thought I would just attached the view I am trying to adjust and the source from where I am pulling it from. In column B the "Symbol", which is a stock symbol, will populate based on the the "GIC Industry"-Column C- and then the top ranked "Return Potential" for all symbols in that "GIC Industry".  As you can see in "Column J" I have all symbols from a master list populated and Ranked based entirely on their "Return Potential".  My issue is that after the top ranked return potential for "Software"-cellC4- populates into cellB4-"BOX US Equity"-how do I create the logic so that if "Software" appears again below-which it does 5 more times in cells C5, C6, C10, C14, C15- Excel returns the 2nd, 3rd, 4th, 5th, and 6th ranked names in the "Software" Industry name-Column I- into the corresponding cells in Column B? As is shown, the logic I used kept returning the top ranked return potential which was BOX US Equity. If you scroll down to cells H48 and I48 you can see that "NET US Equity" is the 2nd ranked "Software" name by "Return Potential".  I would like to know how to create the logic that would make "NET US Equity" populate into cell B8 because it would be the 2nd top 'Return potential" symbol in the specific Industry of Software.  Thank you in advance and I really hope I explained this somewhat coherently.
 

8 Replies

Forgot to add sheet....

@DCL611 I used the following formula to get what you want but I'm sure there are others that might work also.  This does assume you have array formulas in your version of excel:

=INDEX(FILTER(H:H,I:I=C4),COUNTIF(C$1:C4,C4))

I did a similar formula for column E (Return Potential) because I assume you will need that too.  I don't know where column D (Size) comes from.  I have attached the sheet for you to review.  I hope that helps.

@mtarler  Thank you so very much! Just what I was looking for!

Good Morning Mtarler, 

I am having an issue implanting the formula. So without trying to describe my issue in a wordy way I will just provide the sheet i was working on so you can see that on the Portfolio Tab in Column AQ(GIC Industry) that input is coming from column AF and Column AR(Size) is coming from Column AG(Size). What I am attempting to do is simply replace the existing Symbol in the portfolio if there is another symbol in that specific "GIC Industry" that has a better "Return Potential" Column AS. The source for this list is on the "Ranks" tab. Columns X, Y, Z, and AA on that tab are populated with the entire master list of names and sorted by Return Potential. What I am trying to do is ask whether the best possible choice of a particular industry is being chosen purely on a Potential Return basis? I hope this clarifies what I am trying to accomplish, and apologize for the simplification of the original scenario layout.  @DCL611 

@DCL611  The formula appears to work (when modified for those column locations:

=IFERROR(INDEX(FILTER(Ranks!Y:Y,Ranks!Z:Z=AQ8),COUNTIF(AQ$8:AQ8,AQ8))," ")

note you might want to use LARGE() instead of INDEX() in the above formula just in case the list isn't already sorted.

 

 

Unfortunately I am not familiar with the “Filter” function. When I type it into my formula window populates with the following:

 

“FILTERXML Returns specific data from the XML content using the specific XPath”

 

Am I doing something in correctly?

 

My version of Excel is the Office Home & Business 2019, is it possible my version is not adequate or am I simply missing something when trying to apply the formula?

 

When I pull the version up that was adjusted this is what appears in the Function window:

 

=IFERROR(INDEX(_xlfn._xlws.FILTER(Ranks!Y:Y,Ranks!Z:Z=AQ8),COUNTIF(AQ$8:AQ8,AQ8))," ")

 

Once again I truly apologize for any neophyte questions or actions but I simply am not having luck applying the formula when using “Filter” without having the  “ _xlfn._xlws.” in there preceding “Filter”.

 

Thank you

 

Best

 

  David

@mtarler 

Best Response confirmed by DCL611 (Occasional Contributor)
Solution

@DCL611  You are not doing anything wrong, your version of Excel doesn't have dynamic arrays (which means you also don't have some of the new functions that come with it like FILTER(), UNIQUE() and some others).  So going back to old school tricks I think this should work for you:

=IFERROR(OFFSET(Ranks!$Y$1,AGGREGATE(15,7, ROW(Ranks!$Z:$Z)/(Ranks!$Z:$Z=$AQ8),COUNTIF($AQ$1:$AQ8,$AQ8))-1,0)," ")

see attached.  If it works for you I hope you like and mark this as best answer