Hi all,
I'm dealing with a large data table, and want to be able to lookup the rows with the top 10 values (in one column) that match a given condition (in a different column). So far I've done it with some intermediate steps, but am hoping that I can cut these out as it's starting to get quite slow as the table gets larger. So my current method is:
1. Pull out entries that match the condition.
{=INDEX([row name column],MATCH(1,(COUNTIF([already looked up?])=0)*IF([Condition],1,0),0))}
2. Lookup values for these entries
=INDEX([values column],MATCH([row name],[row name column],0))
3. Rank the entries extracted
=RANK([row name],[list of names looked up])
4. Remove any repeat rankings to give a discrete list
=[row rank]+COUNTIF([other rows already given the same rank])
5. Reorder to give the top 10 in order
=INDEX([rankings],MATCH({1-10},[non-repeat rankings]))
=INDEX([row names],MATCH({1-10},[non-repeat rankings]))
=INDEX([values],MATCH({1-10},[non-repeat rankings]))
I've uploaded an example file here:
http://dl.dropbox.com/u/7313338/Lookup%20top%2010%20with%20condition.xlsx
Any suggestions as to how I could get the same result more efficiently?
I'm dealing with a large data table, and want to be able to lookup the rows with the top 10 values (in one column) that match a given condition (in a different column). So far I've done it with some intermediate steps, but am hoping that I can cut these out as it's starting to get quite slow as the table gets larger. So my current method is:
1. Pull out entries that match the condition.
{=INDEX([row name column],MATCH(1,(COUNTIF([already looked up?])=0)*IF([Condition],1,0),0))}
2. Lookup values for these entries
=INDEX([values column],MATCH([row name],[row name column],0))
3. Rank the entries extracted
=RANK([row name],[list of names looked up])
4. Remove any repeat rankings to give a discrete list
=[row rank]+COUNTIF([other rows already given the same rank])
5. Reorder to give the top 10 in order
=INDEX([rankings],MATCH({1-10},[non-repeat rankings]))
=INDEX([row names],MATCH({1-10},[non-repeat rankings]))
=INDEX([values],MATCH({1-10},[non-repeat rankings]))
I've uploaded an example file here:
http://dl.dropbox.com/u/7313338/Lookup%20top%2010%20with%20condition.xlsx
Any suggestions as to how I could get the same result more efficiently?