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 11th, 2002, 04:48 PM   #1
Skebo
New Member
 
Join Date: Feb 2002
Posts: 20
Default

How do I return cell references for multiple maximums within a range?

ABCDEF
125521

Would like this to return, C1 D1

Skebo is offline   Reply With Quote
Old Mar 11th, 2002, 04:57 PM   #2
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Define "multiple maximums".
Mark W. is offline   Reply With Quote
Old Mar 11th, 2002, 05:01 PM   #3
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Quote:
On 2002-03-11 15:57, Mark W. wrote:
Define "multiple maximums".
Two fives in this case I assume, the question seems quite clear!

_________________
Kind Regards
Ian Mac

[ This Message was edited by: Ian Mac on 2002-03-11 16:02 ]
Ian Mac is offline   Reply With Quote
Old Mar 11th, 2002, 05:05 PM   #4
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Quote:
Two fives in this case I assume, the question seems quite clear!
Perhaps you are psychic . Is adjacency a requirement?
Mark W. is offline   Reply With Quote
Old Mar 11th, 2002, 05:11 PM   #5
Skebo
New Member
 
Join Date: Feb 2002
Posts: 20
Default

Quote:
On 2002-03-11 16:05, Mark W. wrote:
Quote:
Two fives in this case I assume, the question seems quite clear!
Perhaps you are psychic . Is adjacency a requirement?
No adjacency is not a requirement. Just return references for all values that are tied for the maximum value within the range. No psychic abilities required.
Skebo is offline   Reply With Quote
Old Mar 11th, 2002, 05:16 PM   #6
Juan Pablo González
MrExcel MVP
 
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
Default

I was going to think a way of doing it with "simple" formulas, but, then, decided to do it the "easy" way. Try with this UDF


Function ReturnMaxs(Rng As Range) As String
Dim Mx As Double
Dim Cll As Range

If Rng.Count = 1 Then ReturnMaxs = Rng.Address(False, False): Exit Function

Mx = Application.Max(Rng)
For Each Cll In Rng
If Cll = Mx Then
If Len(ReturnMaxs) = 0 Then
ReturnMaxs = Cll.Address(False, False)
Else
ReturnMaxs = ReturnMaxs & " " & Cll.Address(False, False)
End If
End If
Next Cll

End Function


_________________
Regards,

Juan Pablo G.
MrExcel.com Consulting

[ This Message was edited by: Juan Pablo G. on 2002-03-11 16:16 ]
Juan Pablo González is offline   Reply With Quote
Old Mar 11th, 2002, 05:21 PM   #7
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

If your values are on row 1:1 enter the formula...

=IF(A1=MAX($A$1:$F$1),ADDRESS(ROW(A1),COLUMN(A1),4),"")

...into cell A2 and fill right to cell F2.

[ This Message was edited by: Mark W. on 2002-03-11 16:22 ]
Mark W. is offline   Reply With Quote
Old Mar 11th, 2002, 05:35 PM   #8
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Do you need the result in the same cell (hope not), otherwise where do you need the result displayed?
__________________
"Have a good time......all the time"
Ian Mac
Ian Mac is offline   Reply With Quote
Old Mar 11th, 2002, 05:55 PM   #9
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Quote:
On 2002-03-11 16:21, Mark W. wrote:
If your values are on row 1:1 enter the formula...

=IF(A1=MAX($A$1:$F$1),ADDRESS(ROW(A1),COLUMN(A1),4),"")

...into cell A2 and fill right to cell F2.

[ This Message was edited by: Mark W. on 2002-03-11 16:22 ]
If you need the results in a single cell modify my formula above to...

=IF(C1=MAX($A$1:$F$1),ADDRESS(ROW(C1),COLUMN(C1),4)&" ","")

...and then include the formula...

=A2&B2&C2&D2&E2&F2

...for your final results.

Mark W. is offline   Reply With Quote
Old Mar 11th, 2002, 06:05 PM   #10
Guest
 
Posts: n/a
Default

Very nice Mark, I tried your formula and pressed the old F9 and got '={"C1 "}', bizarre but nice! I have a different solution to this problem that gives all the addresses in cells next to each other using a few formulas to return the cells ref's in a constant line, i.e. in A2 A3 A4 etc.
I can't remember it off the top of my head, it's at work??!!
proving you ARE the master, BUT I am the mind reader ,

if my IDEA!!?? is worth it, I'm back at work Wednesday. yours and.........
  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 04:43 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