![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: May 2002
Location: Ireland
Posts: 6
|
This seems like something that should be easy to do but.......
I want excel to sort a field using functions, so that it's done automatically with needing anyone to manually mess with it. However everything falls apart when two or more fields have the same value e.g. when I have 3 items in 6th place. Is there another function that I could use to get excel to use the next field to sort those items that have the same value and then return to the first field to continue again. I'm basically trying to emulate the Data;Sort function, where the sort order can be specified. Any help would be appreciated |
|
|
|
|
|
#3 |
|
Join Date: Mar 2002
Location: Near the Land of Oz
Posts: 1,548
|
Chris,
Although I didn't ask this question, it does lead into a project I have. My problem with the rank is that I have 17 cities down the sides, and six companies across the top. But for each company I have three columns of data. Thus, to rank each one, I would need to select, for example, E3, H3, K3, N3, Q3, T3. It doesn't seem that rank works in non-continguous files. Is there any way around this?
__________________
- old, slow, and confused ... but at least I'm inconsistent - (retired Excel 2003 user, 3.28.2008)
|
|
|
|
|
|
#4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MrExcel MVP
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
|
Shades,
rather than use non-contiguous ranges in the formula, replace them with a named range that refers to a range of the non-contiguous cells :
To see the formula in the cells just click on the cells hyperlink The above image was automatically generated by [HtmlMaker V1.20] If you want this code, click here and Colo will email the file to you. This code was graciously allowed to be modified: by Ivan F Moala All credit to Colo However, not sure how you'll get round duplicates in this case as countif certainly doesn't seem to like a named range.... I'll have a think on that one, but the basic answer is yes, use named ranges instead for basic ranking
__________________
:: Pharma Z - Family drugstore :: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
#5 |
|
Join Date: Mar 2002
Location: Near the Land of Oz
Posts: 1,548
|
Thanks, Chris.
However, the ranking is always between 1 and 6. And the ranking repeats for every city. Like this: Company RRR SSS TTT XXX YYY ZZZ Dover 1 3 5 6 4 2 Nairobi 3 5 6 2 1 4 For each city, each company has a certain value (i.e. sales). Those six companies then are to be ranked within that city. Each month those sales figures change. (As an added issue, I need to set the cell color based on that ranking. And this changes each month.) Altogether I have 41 cities in two separate worksheets - but always the same six companies (requirements that I cannot change). Hope this explains a little better.
__________________
- old, slow, and confused ... but at least I'm inconsistent - (retired Excel 2003 user, 3.28.2008)
|
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
|
Quote:
Or, somewhere safe and unused, reference the data that you want ranked with simple linked cells into a range that is contiguous and just perform the rankings on that range Your 6 colours are going to need a VBA solution... there's 3 max via conditional formatting
__________________
:: Pharma Z - Family drugstore :: |
|
|
|
|
|
|
#7 |
|
Join Date: Mar 2002
Location: Near the Land of Oz
Posts: 1,548
|
I had thought about the separate file just for doing the ranking. That may be the easiest solution.
As for the six colors, after investigating a little over the past month, I knew that VBA was the only option. I now have a book on VBA that I am beginning. So, perhaps in a few weeks I will have the code I need. Thanks again for the help.
__________________
- old, slow, and confused ... but at least I'm inconsistent - (retired Excel 2003 user, 3.28.2008)
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
|
if you get stuck, there's a few examples already written - off the top of my head try a search on this site for entries by Ivan with conditional format as the keywords
Good luck with the VBA book, I think I probably have the same one sitting on my desk here shouting at me ! |
|
|
|
|
|
#9 |
|
Join Date: Mar 2002
Location: Near the Land of Oz
Posts: 1,548
|
Just to let you know, the rank function worked great. Now I have it as part of a working template for every month. Saves even more time. Thanks!
__________________
- old, slow, and confused ... but at least I'm inconsistent - (retired Excel 2003 user, 3.28.2008)
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|