# Return defined number of matches in table

1. ## Return defined number of matches in table

Hello,

Can someone point me in the right direction please; I'm sure i'm not phrasing my question correctly so struggling to find any help...

I'm trying to get a formula to return a defined number of matches in a table. For example; if you have ten people listed in column A from 1 to 10 and next to them in column B is their preferred drink (lets say wine or beer). This just happens to be split into 4 wines and 6 beers - i want to be able to use a formula to return the names of the top 3 people who want beer, if I define in another cell that only 3 beers are available.

My intention is to another formula to "mark" these chosen people and put them to the bottom of the list so next time, the people who didn't get a beer this time will get priority next time over those who did.

i keep getting results in my searches to do with index/match formulas but not sure this is exactly what i need.

any suggestions on where i should be looking?

Thanks

2. ## Re: Return defined number of matches in table

Suppose you have Beer or Wine in column B, starting with cell B2. Then you can have this formula in C2:

=IF(B2="","",B2&"_"&COUNTIF(B\$2:B2,B2))

and copy this down. It will repeat the drink from column B and tag on to the end of it a running count of the number, so Beer_1, Beer_2 and Beer_3 can easily be identified as the top-3 beer drinkers.

Does that help you? (I'm not really sure what you want after that - maybe posting a sample workbook might help).

Pete

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1