#1
|
|||
|
|||
Conditional format a table cell based on percentage range
Hi all,
was wondering if someone was able to help me out? I want to conditionally format a cell in a table in MS Word based on a percentage range Red >=91.99% Amber 92% - 93.99% Green >=94% I've read a couple of threads about VBA, but VERY VERY new to it all. HELP!!!! Thanks in advance |
#2
|
||||
|
||||
Depending on your requirements, this can be done via field coding or a macro.
However, since you haven't told us anything about the mechanism by which these cells get populated, it's impossible to give any advice specific to your situation.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
You could also incorporate an Excel part in your document. Conditional formatting is far easier in Excel.
|
#4
|
|||
|
|||
Conditional format a table cell based on percentage range
Quote:
The word document has 4 or 5 tables. I want to apply a conditional format to table 4 row 2 (only one cell) In the cell below YOUR CHILD’S ATTENDANCE PERCENTAGE IS... There is a percentage (merged field) this cell is what I want to conditionally format where the cell is filled with colour (according to the outline below). RED = <91.99% AMBER = >=92% <=93.99% GREEN = >94% |
#5
|
||||
|
||||
In which case you don't need a macro - all you need is some field coding. See Conditionally Format Mailmerge Output, Conditionally Shade Table Cells, and Conditionally Colour/Shade Numeric Output Ranges in the Mailmerge Tips & Tricks 'Sticky' thread at the top on the Mailmerge forum, to which I've moved your thread. Any of those approaches can be leveraged to achieve the desired result.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Is there a way I can add that to the field coding I have in there already?
I currently have {=«Percent»*100 \# 0.00%}. So based on whatever this results spits out, I want to shade the cell according to the % range I mentioned earlier? Thanks a million for all the support |
#7
|
||||
|
||||
Quote:
{QUOTE {SET Val {={MERGEFIELD Percent}*100 \# 0.00 }}{=INT(Val-93) \# "'→↵ {Val} →';' →↵ {Val} →';' →↵ {Val} →'"}"}}% where the relevant highlight colours are applied to the field coding according to the colouring (we can't do highlighting here) and each cell to be shaded has: • margins set to 0 all round • paragraph formatting with a single right-aligned tab-stop set to at least the cell width. Note: The spaces shown in the field constructions are all required. Instead of the → and ↵ symbols shown above, you should use real tabs and line/paragraph breaks, respectively.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Quote:
|
Tags |
conditional formatting, ms word, tables |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to conditional format a table cell in word based on it's value. | JulianS96 | Word VBA | 9 | 10-20-2021 02:25 AM |
Need Conditional based percentage formula! | jocky6688 | Excel | 5 | 03-15-2021 12:35 AM |
Conditional Formatting on cell values outside of a designated range based on category denoted in key | interntime | Excel | 3 | 05-21-2018 10:15 PM |
Floating date range on a conditional format | Old | Excel | 2 | 06-22-2017 08:32 AM |
Conditional format a button based off a value in a field | Triscia | Misc | 0 | 03-11-2015 11:12 AM |