# Thread: Changing cell colour (MSO2003 winxp pro)

1. ## Changing cell colour (MSO2003 winxp pro)

I am wishing to change the fill colour of a cell based on the result of the calculation in that cell.

I thought this would be a fairly straight forward little thing to solve. Have tried { =b2*c2} which works fine and then tried { if(b2*c2>4,0,0) } and for the life of me I cannot figure out how to get the result and or cell to change colour.

Can anyone help.

2. ## Re: Changing cell colour (MSO2003 winxp pro)

Hi Phil,

Word tables don't support the sort of conditional formatting that you can use in Excel to change a cell's colour. However, you can get a Word formula to format its results in different colours etc depending on the result. For more information on how to do this, see 'Formatting Numeric Field Results' in <post#=365442>post 365442</post#>

Cheers

3. ## Re: Changing cell colour (MSO2003 winxp pro)

Macropod thanks for that.

I concur with others. That's a hell of a document.

However, I just can't seem to get this formula right, { =If(b2*c2>4 # 0,0,0) } with the numeric picture formatted to show the result in "red". I keep getting this error message "!Unexpected End of Formula"

4. ## Re: Changing cell colour (MSO2003 winxp pro)

It's not quite clear to me what tou want to accomplish, but you could try

{ IF { = B2 * C2 } > 4 "<font color=448800>Greater</font color=448800>" "<font color=red>Lesser</font color=red>" }

where both the inner and outer brackets are field brackets (insert by pressing Ctrl+F9 or Insert | Field..., NOT by typing them)

5. ## Re: Changing cell colour (MSO2003 winxp pro)

I think maybe there is something missing. IF fields usually have a test, then a true result, then a false result -- with no commas.

{ IF 2 > 1 "Known laws of mathematics apply in this place." "Hang on to your hats!" }

For the color, maybe you can do this: Have two IF fields, one that display only when true and one that displays only when false, one formatted black and the other formatted red. (Note: this would work for the text color, not the cell's background color.)

6. ## Re: Changing cell colour (MSO2003 winxp pro)

Hans thanks for that

This is driving me bananas!

This is my code: { if { b2 * c2 } > 4 <font color=red>"High Risk!" </font color=red> <font color=448800>"Low Risk"</font color=448800> } doesn't work

7. ## Re: Changing cell colour (MSO2003 winxp pro)

Jefferson thanks as well

I tried nesting IFs but couldn't that to work either!

8. ## Re: Changing cell colour (MSO2003 winxp pro)

I wasn't suggesting nesting, but having them side-by-side. See the attached.

9. ## Re: Changing cell colour (MSO2003 winxp pro)

Your embedded field doesn't look right. See the attached. It helps to test each embedded field separately as you go so you can rule out that kind of problem.

Note: This document is not supposed to contain a macro. If asked, Disable macros in the attached document.

10. ## Re: Changing cell colour (MSO2003 winxp pro)

You didn't include the = in the inner field. Jefferson has posted some working examples (thanks, Jefferson!).

11. ## Re: Changing cell colour (MSO2003 winxp pro)

Jefferson and Hans thanks again.

I don't know where many of us would be without guys like you to lean on.

I gather for conditional statements the numeric picture switches, that apply for straight calculations, do not work to enable the result to be coloured.

12. ## Re: Changing cell colour (MSO2003 winxp pro)

Color is not a numeric format, as far as I know. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> However, if you have positive and negative formats (separated by a semicolon), you can color them separately.

Using the two-IF approach, you can select the entire field and apply any formatting you like "from the outside." When working with a single field, you'll have to carefully do it inside the field.

13. ## Re: Changing cell colour (MSO2003 winxp pro)

Jefferson thanks again

I'll probably leave well alone for now.

14. ## Re: Changing cell colour (MSO2003 winxp pro)

Hi Phil,

See the attached file, in which I've given you three ways to solve this problem. The solution in A1 also allows for a 'Medium Risk' output if you want it. If not, you can simply delete the last semi-colon in the field and everything after it.

Cheers

15. ## Re: Changing cell colour (MSO2003 winxp pro)

Macropod

Thanks again. I am not sure I understand how the first option works {=b2*c2-4 # High Risk!;Low Risk;Medium Risk}.

cheers

Page 1 of 2 12 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•