MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 8th, 2002, 01:09 PM   #1
Skebo
New Member
 
Join Date: Feb 2002
Posts: 20
Default

Hi All,

I have a table that looks something like this

Top Perf|Judy|Paul|Mary|Mark
Mark | 1| 0| 3| 5
Judy | 3| 1| 1| 3
Judy | 0| 0| 0| 0

Under "Top Perf" I have the following formula:
=INDIRECT("R1"&"C"&1+MATCH(MAX(B3:G3),B3:G3,0),FALSE)

This works fine for the first row of data, where it returns "Mark". I want to change the results for the last two rows.
1.) In cases where there is a tie I would like both names displayed in the same cell(separated by a comma if possible).
2.) In cases where there are all zeros, return #NA. MATCH returns the first 0 as the maximum value right now. These cells can not be left blank instead of containing a 0.
3.) When any one surpasses a threshold value of 10, I want all of those names displayed instead.

I hope this is clear and thanks in advance.



[ This Message was edited by: Skebo on 2002-03-08 12:09 ]

[ This Message was edited by: Skebo on 2002-03-08 13:02 ]

[ This Message was edited by: Skebo on 2002-03-10 19:11 ]
Skebo is offline   Reply With Quote
Old Mar 10th, 2002, 08:12 PM   #2
Skebo
New Member
 
Join Date: Feb 2002
Posts: 20
Default

I'm still stuck on this. Anyone? Anyone?
Skebo is offline   Reply With Quote
Old Mar 10th, 2002, 10:58 PM   #3
Corni
Board Regular
 
Join Date: Mar 2002
Location: Brampton
Posts: 324
Default

Try this formula:

=IF(AND(B2=0,C2=0,D2=0,E2=0),"#NA",IF(OR(B2>10,B2=MAX(B2:E2)),OFFSET(B2,1-ROW(B2),0)&",",""))&IF(SUM(B2:E2)=0,"",IF(OR(C2>10,C2=MAX(B2:E2)),OFFSET(C2,1-ROW(C2),0)&",",""))&IF(SUM(B2:E2)=0,"",IF(OR(D2>10,D2=MAX(B2:E2)),OFFSET(D2,1-ROW(D2),0)&",",""))&IF(SUM(B2:E2)=0,"",IF(OR(E2>10,E2=MAX(B2:E2)),OFFSET(E2,1-ROW(E2),0),""))

As you have only four names, the range should be B2:E2 and not B2:G2.

[ This Message was edited by: Corni on 2002-03-10 22:00 ]
Corni is offline   Reply With Quote
Old Mar 12th, 2002, 02:16 PM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-03-08 12:09, Skebo wrote:
Hi All,

I have a table that looks something like this

Top Perf|Judy|Paul|Mary|Mark
Mark | 1| 0| 3| 5
Judy | 3| 1| 1| 3
Judy | 0| 0| 0| 0

Under "Top Perf" I have the following formula:
=INDIRECT("R1"&"C"&1+MATCH(MAX(B3:G3),B3:G3,0),FALSE)

This works fine for the first row of data, where it returns "Mark". I want to change the results for the last two rows.
1.) In cases where there is a tie I would like both names displayed in the same cell(separated by a comma if possible).
2.) In cases where there are all zeros, return #NA. MATCH returns the first 0 as the maximum value right now. These cells can not be left blank instead of containing a 0.
3.) When any one surpasses a threshold value of 10, I want all of those names displayed instead.

I hope this is clear and thanks in advance.



[ This Message was edited by: Skebo on 2002-03-08 12:09 ]

[ This Message was edited by: Skebo on 2002-03-08 13:02 ]

[ This Message was edited by: Skebo on 2002-03-10 19:11 ]
Skebo,

It took me some time to come back to this hard question.

First of all you need Longre's morefunc.xll, which contains a UDF called MCONCAT that I use in what follows:

I'll assume that A1:E4 houses the sample data you provided where A2:A4 must show results (top performers), concatenated together with a comma as separator.

In G2 enter:

=IF(SUM($B2:$E2)>0,IF(B2=MAX($B2:$E2),INDIRECT(ADDRESS(1,COLUMN(B2)),4),""),"")

Copy down this till row 4 then across as many columns as you have in your data range.

In A2 array-enter and copy down till row 4:

=TRIM(SUBSTITUTE(IF(SUM(B2:E2),MCONCAT(G2:J2,IF(LEN(G2:J2),",","")),MCONCAT($B$1:$E$1,",")),",,",","))

Note. You need to hit control+shift+enter at the same time, not just enter, to array-enter a formula.

I know the solution is a bit demanding. Until there is something better on offer, you might want to use it.

The data plus the results areas will look as follows:

{"Top Perf","Judy","Paul","Mary","Mark ","","","","","";
"Mark",1,0,3,5,0,"","","","Mark ";
"Judy,Mary,Mark",3,1,3,3,0,"Judy","","Mary","Mark ";
"Judy,Paul,Mary,Mark",0,0,0,0,0,"","","",""}

You can get morefunc at:

http://perso/wanadoo.fr/longre/excel/downloads/

Aladin



[ This Message was edited by: Aladin Akyurek on 2002-03-12 13:18 ]

[ This Message was edited by: Aladin Akyurek on 2002-03-12 13:19 ]
Aladin Akyurek is offline   Reply With Quote
Old Mar 12th, 2002, 05:15 PM   #5
Skebo
New Member
 
Join Date: Feb 2002
Posts: 20
Default

Thanks Aladin. It works for the most part. This gives me something to build upon. If guess parts 2 and 3 can be covered by an if then statement.
You may be interested to know that if 'Judy' isn't among a tie for top performer, then the names returned are not comma separated. ie values of 0,0,5,5 will return "MaryMark", whereas 5,0,5,5 will return "Judy,Mary,Mark". No biggy. Just an FYI.
Skebo is offline   Reply With Quote
Old Mar 12th, 2002, 05:24 PM   #6
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-03-12 16:15, Skebo wrote:
Thanks Aladin. It works for the most part. This gives me something to build upon. If guess parts 2 and 3 can be covered by an if then statement.
You may be interested to know that if 'Judy' isn't among a tie for top performer, then the names returned are not comma separated. ie values of 0,0,5,5 will return "MaryMark", whereas 5,0,5,5 will return "Judy,Mary,Mark". No biggy. Just an FYI.
Skebo,

I admit I didn't check thorougly the behavior of MCONCAT. I had to solve e.g., the multiple comma problem that I ecountered as in ",,,Mark" with using SUBSTITUTE. Maybe you could look more closely at this function to solve the absent comma problem.

Aladin
Aladin Akyurek is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 09:02 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes