Conditional formatting

MitchS

New Member
Joined
Jan 6, 2011
Messages
34
Lets see how I can explain this...I'm not good with XL formulas at all! I have a XL sheet I use for horse racing. Lots of numerical data on this sheet. I export the data from MS Access onto an XL sheet. A guy helped me with a formula that separates the races so I have a header on top of each race. Once the races are separated with headers on top I then copy and paste into a fresh XL sheet away form the sheet with the seperator code.

Here's what I want to do. I want to automatically highlight the top 3 numerical values in each race on various columns.

Now I know how to get the TOP RANKED highlighted IF the whole XL sheet was just ONE RACE...BUT my XL sheet gets separated into may 10 races AND I also want the top 3 highlighted not just the top one.

IF the sheet was one race and I Just wanted the top ranking I could use this...

"Equal to" =MAX($A$1:$A$200)


That would give me the top ranking on the whole sheet BUT....

The problem is that each sheet is separated in maybe 10 races so there is no EXACT constant with the column numbers as they change slightly with I seperate the races.


My question then is it possible to highlight the top 3 numerical values on a XL sheet where the column numbers are not constant as they change slightly when I separate the races for day to day use. The reason this is, is because there is no constant on the number of horses in each race.

Make sense? Is this possible?

Mitch
 
I'm dedicated to being here as long as it takes to learn how to implement this formatting..

I thought that if I used Peters formula, that would give me the 'N,O,P" grouping. If I can understand that grouping then I could use that formula to set up the other groupings with further conditions1,2,3 etc with different colors etc..? Is that correct? Seems to make sense to me?

What I've tried has failed. This is what I've done to try and get the "N,O,P" grouping in yellow.

1. Click on format, then conditional formatting

2. 1st drop-down set to "formula is"

Also is there a way to copy and paste into this formula window from word? Doesn't seem to let me. I have to manually type in each formula?

3. From Peters formula I made a few changes that I though would give me what I'm looking for from this grouping.

I typed in the formula window-

<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> CellNr.: / ConditionFormatN1. / Formula is =AND(N1>=LARGE(IF($B$1:$B$150=$B1,N$1:N$150),3),N1<>"")


Then I hit format. Then I made the color yellow. then OK


Formula doesn't work? I'm off somewhere?


Trying to use the ",N,O,P" grouping from column 1 through 150, color yellow.


I'll be here all day. Need some advise to get to the next step before I can continue.


Thanks ahead of time for any help from anyone,
Mitch
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Here's an example of what I want do. Maybe you can point me in the right direction-
What follows the above is quite a wordy description which is somewhat difficult to follow given that we are not that familiar with your sheet. Since you have the HTML Maker working, why not illustrate that description with a screen shot?

You could set up a dummy sheet with say 2 races with 7 horses in each. You can colour the cells manually to show what results you want and you can hide columns that are not relevant to help the screen shot fairly small. Make sure any written description/explanation refers to the data in the screen shot.




Also is there a way to copy and paste into this formula window from word? Doesn't seem to let me. I have to manually type in each formula?
Why are you working in Word in the first place?
 
Upvote 0
OK, that's a good idea. I'll set up a dummy sheet with two races and manually fill in the colors. I'm on it:)

As far as why I'm working in word, well...what should I be working in?
 
Upvote 0
As far as why I'm working in word, well...what should I be working in?
When I'm composing a MrExcel post I just compose it directly in the Quick Reply window. If I want to post a formula (without the HTML Maker which will do the formulas automatically) I copy it from the formula bar in Excel and paste directly into my post.
 
Upvote 0
I changed my mind and simplified the process.

1. Use same color
2. Highlight the top 2 HIGHEST in columns- H,K,L,N,O,Q,U,V,X
3. Highlight the top 2 LOWEST in columns- R,AA,AB
Excel Workbook
HIJKLMNOPQR
1W-fitPCLSE1E2Q/SSR-LSR-L9SR-9ALateKic
276-15472717 - EP878682924.8
382-15071723 - NA868579898.7
4770076470 - NA8384811045.3
5740047518 - E1007970933.8
684-15070625 - EP6176443413.8
7
8W-fitPCLSE1E2Q/SSR-LSR-L9SR-9ALateKic
984255088883 - E/P1081041011077.1
109836685851 - S102961071056.5
1186167984732 - P97941051383
1277135289873 - E/P103010282-3
1389-2107285830 - S8001031102.6
1482254565690 - S980941258.9
15
DED1
Excel 2003
Excel Workbook
STUVWXYZAAAB
1W%ITMJ%T%WDCompR-fitMLV-L9V-L
20071311081054.52.66
300190-210810233.28.6
400129092105154.411
50020518853205.75
600121917754159.23
7
8W%ITMJ%T%WDCompR-fitMLV-L9V-L
93333121601289151.64.3
102550121811339032.15.3
11501001122-11329262.816
122550287130891206.9
13166617172130924.504.8
145050196-2114931008.7
15
DED1
Excel 2003
 
Upvote 0
Columns...A,B,C,D,E,F,G do not need any highlighting. The numbers will always start with 2 at the top and run through about 150 because there are 10 races generally.

Below is the beginning of the sheet. Put the 3 sheets together and that is one complete sheet.
Excel Workbook
ABCDEFG
1TKRNHorsePNAgeLRWA
2Ded1Ay Dios Mio52365
3Ded1Captainwoodrowcall623682
4Ded1Who Dat Ghost1223513
5Ded1Phone Speed1123513
6Ded1Doc R U It32487
7
8TKRNHorsePNAgeLRWA
9Ded2Caddo Native32215
10Ded2Watch My Smoke522755
11Ded2Man Of Strife62575
12Ded2Z Native721726
13Ded2Jump Jump124713
14Ded2K One Four82282
DED1
Excel 2003
 
Upvote 0
Here is one way. I have used row 150 as the maximum. If you might need more than that you would need to allow for that in my descriptions below and in the formulas referencing row 150.

1. Clear any existing Conditional Formatting from the sheet, or start a new sheet with just the raw data. I suggest using the sample data you gave above to start with so you can compare to my results below.

2. Select H1:H150. You can do this by dragging down the column or by typing H1:H150 in the 'Name Box' (the white box to the left of the formula bar) and pressing Enter.

3. In Conditional Formatting use 'Formula is' with this formula:

=AND(H1>=LARGE(IF($B$1:$B$150=$B1,H$1:H$150),2),H1<>"")
and apply your colour. OK and OK to exit out of the CF dialog.

4. With H1:H150 still selected, double click the 'Format Painter' (paint brush icon in the toolbar).

5. Now carefully click the following cells only: K1, L1 ,N1, O1, Q1, U1, V1, X1

6. Before clicking anywhere else, click the Format Painter once more to de-activate further 'painting' of this format.

7. Select R1:R150 and use this formula in Conditional Formatting:

=AND(R1<=SMALL(IF($B$1:$B$150=$B1,R$1:R$150),2),R1<>"")
and set you colour (can be a different colour if you want).

8. With R1:R150 still selected use the Format Painter as above to apply the Format to columns AA and AB.

9. Remember to de-activate the Format Painter again.


I believe that will do what you have shown above with 2 exceptions which I have described below and highlighted blue in my screen shot:

a) I think this was just a mistake when you were applying colour manually but you have cell V4 highlighted when V2 is a larger number.

b) This one may require a little more work. In column AA for race 2 yo have 1.6 and 2.1 highlighted as the 2 lowest numbers. However, there are 3 zeros in that column/race and of course 0 is lower than the 2 numbers you have highlighted so my code highlights the 0s instead. What is the circumstance there?


Excel Workbook
ABGHIJKLMNOPQRSTUVWXYZAAAB
1TKRNWAW-fitPCLSE1E2Q/SSR-LSR-L9SR-9ALateKicW%ITMJ%T%WDCompR-fitMLV-L9V-L
2Ded1576-15472717 - EP878682924.80071311081054.52.66
3Ded18282-15071723 - NA868579898.700190-210810233.28.6
4Ded113770076470 - NA8384811045.300129092105154.411
5Ded113740047518 - E1007970933.80020518853205.75
6Ded1784-15070625 - EP6176443413.800121917754159.23
7
8TKRNWAW-fitPCLSE1E2Q/SSR-LSR-L9SR-9ALateKicW%ITMJ%T%WDCompR-fitMLV-L9V-L
9Ded2584255088883 - E/P1081041011077.13333121601289151.64.3
10Ded2559836685851 - S102961071056.52550121811339032.15.3
11Ded2586167984732 - P97941051383501001122-11329262.816
12Ded22677135289873 - E/P103010282-32550287130891206.9
13Ded21389-2107285830 - S8001031102.6166617172130924.504.8
14Ded2282254565690 - S980941258.95050196-2114931008.7
Cf within race (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H11. / Formula is =AND(H1>=LARGE(IF($B$1:$B$150=$B1,H$1:H$150),2),H1<>"")Abc
R11. / Formula is =AND(R1<=SMALL(IF($B$1:$B$150=$B1,R$1:R$150),2),R1<>"")Abc
 
Upvote 0
I believe that will do what you have shown above with 2 exceptions which I have described below and highlighted blue in my screen shot:

a) I think this was just a mistake when you were applying colour manually but you have cell V4 highlighted when V2 is a larger number.

b) This one may require a little more work. In column AA for race 2 yo have 1.6 and 2.1 highlighted as the 2 lowest numbers. However, there are 3 zeros in that column/race and of course 0 is lower than the 2 numbers you have highlighted so my code highlights the 0s instead. What is the circumstance there?

Yes, "a" is my mistake and "b" I've decided not to highlight that column because a "0" should not be highlighted. Its really a N/A not a 0. That's fine, no big deal..

Thank you. I actually did it! And learned a bit about XL along the way:)

I'm going to save the sheet. Delete the data and then bring new data to the sheet and see what happens. Be back to let you know.
 
Upvote 0
Works great! :)... I'm curious though. Is it possible without too much trouble to bypass the "0" as the lowest. In other words when a "0" shows up on the sheet the formula will not highlight the "0" ?
 
Upvote 0
Works great! :)... I'm curious though. Is it possible without too much trouble to bypass the "0" as the lowest. In other words when a "0" shows up on the sheet the formula will not highlight the "0" ?
It is possible, but it would add yet another level to the already resonably complex and resource-heavy Conditional Formatting. You may note that the sheet is already becoming a little slow to respond?

Would you consider this option? Select all the relevant columns (eg select column R by clicking its heading label then hold Ctrl while clicking, say, the column AA and AB labels) then ..

Edit|Replace...|Find what: 0 Replace with: N/A |Options>>|check 'Match entire cell contents|Replace All|OK|Close

If you do want the CF option, please ..

1. Confirm whether vto ignore zero values only applies to columns R, AA and AB or whether it is also to apply to the 9 'LARGE' columns as well.

2. Confirm that if these numbers
7
4
2
0
-3
5

appeared in column V then you would want to ignore the 0 and highlight -3 and 2.
 
Upvote 0

Forum statistics

Threads
1,221,572
Messages
6,160,575
Members
451,656
Latest member
SBulinski1975

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top