Question

Excel - find the two highest figures and highlight them in different colours

Asked by: mpux

Hi Experts- great to be on this site again. Can you help with this?  

For each row in the spreadsheet I want to find the two highest figures and highlight them in different colours.  Is it possible to create a macro that could do this?  I have 5 spreadsheets I need to do the same with and currently doing it manually.

Thanks, Mike

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-03-03 at 03:47:17ID20905301
Tags

excel

,

highest

Topic

Microsoft Excel Spreadsheet Software

Participating Experts
5
Points
250
Comments
16

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Freeforms  and colours
    I have a football spreadsheet, which has 11 freeforms in colum G and the team name againest them in colum H, I would like to when I enter the team name in colum H, it to change the the colour in colum G. Many Thanks Chris Kemp
  2. How do I fill cells with colour depending on numerical value i…
    I have a range of data on a worksheet that I import from the internet on a regular basis. The data is on seperate rows like below 1 -24.079 359.172 17.32 -26.556 -69.91 118.935 -59.613 16.733 31.923 -52.826 -29.819 -73.196 36.444 2 54.488 80.147 45.663 59.839 35.647 124.2...
  3. scattergram colour
    I want to show different points in a scattergram in different colours. I have drawn the graph, but now want to be able to see which points correspond to the data they represent. (The data representing the points can be grouped, and I want to see – and show graphically- if t...
  4. Copying Background Colour in a Macro
    I have devloped a macro that copies data from another spreadsheet, does anyone know a line which I can add to it, which coipies the cell background colour as well or a way of doing it? Thanks Poly
  5. Excel spreadsheet opening in different colours
    I am using excel 2003. I regularly use a spreadsheet which has particular colours assigned to each field. Recently when I open up the document the colour have been changing. This is a generic spreadsheet which everyone in the company use, and the traditional colour appear...
  6. Conditional format to colour highest number in a row
    Using Excel 2003, is it possible to apply a conditional formatting formula to a row of numbers (e.g. D11:Q11) so that the highest number in that row becomes coloured? If so, what is the formula to achieve this please? Thank you.

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: roos01Posted on 2004-03-03 at 03:52:27ID: 10503659

try to use the next function:
For Highest: =LARGE(B1:H1;1) where B1 till H1 is the range where to look
For second Highest: =LARGE(B1:H1;2) where B1 till H1 is the range where to look

I hope this will help you,

regards,

jeroen

 

by: crxmailPosted on 2004-03-03 at 04:09:52ID: 10503764

Using the function =LARGE(A$1:A$7,1) as conditional formating rule, where 'cell value is equal to' to define colors for highest number
and =LARGE(A$1:A$7,2) to get the second highest and set a different colour

Change the cell ranges to the ones you want to be highlighted

 

by: crxmailPosted on 2004-03-03 at 04:15:55ID: 10503795

Sorry you need to add the $ signs in front of the column values as well ie. =LARGE($A$1:G$1,1)
if you want it to work for the rows (the first example is for columns)

You will need to set the rule for each row though.

 

by: fanpagesPosted on 2004-03-03 at 04:17:45ID: 10503813

Hi,

Further to jeroen's suggestion...

You can then add conditional formatting based on a formula,

e.g.

Hightlight cells B1:H1, and then select "Conditional Formatting..." from "Format" menu.

Ensure Condition 1 reads as:

Formula Is =CELL("contents",INDIRECT("R"&ROW()&"C"&COLUMN(),FALSE))=LARGE(B1:H1,1)

Then set the appropriate formatting (colour) of the Cell.

BFN,

fp.

 

by: crxmailPosted on 2004-03-03 at 04:41:24ID: 10503963

After testing you can set the conditional formatting for the entire cell array you want to by using only 1 rule.

IE. if your data goes from A1 to D4

the highest in each row can be highlighted by setting the rule equals to:
=LARGE($A1:$D4,1)
and the second highest
=LARGE($A1:$D4,2)

if you want the highest in each column
=LARGE(A$1:D$4,1)
and 2nd
=LARGE(A$1:D$4,1)

 

by: crxmailPosted on 2004-03-03 at 04:43:33ID: 10503980

pfff i am really not awake yet sorry. this only gets the ones in the first and last row.

 

by: roos01Posted on 2004-03-03 at 05:29:28ID: 10504264

or try this:

assuming values are in B3:B30
place in B1 the formula For Highest: =LARGE(B3:B30,1) where B1 till H1 is the range where to look
place in B2 the formulaFor second Highest: =LARGE(B3:B30,2) where B1 till H1 is the range where to look
then do conditional formating Format>>Conditional formating
select here the option formula and for cell B3 you enter the next value =B3=$B$1 and select the format color or fontype as you like. this will make the highest  number visible

select here the option formula and for cell B3 you enter the next value =B3=$B$2 and select the format color or fontype as you like. this makes the second highest value visible

copie these format over the other cells of the range B43:B30 using pastespecial>>format

regards,

Jeroen

 

by: brettdjPosted on 2004-03-04 at 20:50:01ID: 10520117

This has the same approach as the above but doesn't use any calculation cells and uses only one conditional formula. Not exactly what you wanted for this one but I thought it worthwhile for future reference as you can colour a range of values with this approach

If the data was in B2:AK2 then

Formula Is  = SUM(IF(D2=LARGE($B$2:$AK$2,ROW(INDIRECT("1:2"))),1,0))

will highlight any cells equal to the largest two values.
Change the "1:2" part to change the number of large values searched for

A detailed explanation of this method http://oldlook.experts-exchange.com:8080/Applications/MS_Office/Q_20646066.htm

Cheers
Dave

 

by: fanpagesPosted on 2004-06-15 at 07:20:17ID: 11315479

I respectfully suggest the question is now closed & points/grading awarded accordingly.

Thank you.

BFN,

fp.

 

by: MalicUKPosted on 2004-10-19 at 06:31:28ID: 12346952

No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

SPLIT: roos01 {http:#10503659}, crxmail {http:#10503764}

Please leave any comments here within the next four days.

MalicUK
EE Cleanup Volunteer

 

by: fanpagesPosted on 2004-10-19 at 06:34:42ID: 12347012

Hi MalicUK,

Was my suggestion (03/03/2004 12:17PM GMT) not considered suitable?

BFN,

fp.

 

by: MalicUKPosted on 2004-10-19 at 08:23:32ID: 12348231

Hey fp,

I agree that your solution works, but the first two would be the best solutions to this problem, as well as the formula being alot simpler. crxmail suggested conditional formatting first. I'm always willing to listen to other points of view though.

MUK

 

by: roos01Posted on 2004-10-19 at 10:12:07ID: 12349468

Hello MUK,
Looking to fp coment using the INDIRECT option I think this is also an approach to this solution and by accepting also fp answer this answer will also pointed as acceptable answer. So they have 3 option to choose at.
(Just my opinion)

regards,
Jeroen

 

by: MalicUKPosted on 2004-10-20 at 01:44:55ID: 12356007

roos01,

No problem mate. Like I said I'm always happy to reconsider if necessary.

Admin, please change my recommendation for this Q to:

SPLIT: roos01 {http:#10503659}, crxmail {http:#10503764}, fanpages {http:#10503813}

Cheers,
MalicUK
EE Cleanup Volunteer.

 

by: fanpagesPosted on 2004-10-20 at 02:21:59ID: 12356207

Thanks guys.

Sorry... I didn't mean to impose my suggested solution on you, just that nobody had referred to it up to that point.

:)

I often use the INDIRECT function in Conditional Formatting to highlight cell entries where I am expecting numbers (only) as follows:

=NOT(ISNUMBER(CELL("contents",INDIRECT("R"&ROW()&"C"&COLUMN(),FALSE))))

Like you said, it's another alternative.

BFN,

fp.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...