# Thread: IF formula in a Word table

1. ## IF formula in a Word table

Hello, just spent a couple of days trying to get formula to work in MS Word (2011 Mac)

Eventually I was able to get the following to work:

Code:
`{=IF(B3>=10,10,0)}`

(Shows 10 if the table cell B3 is 10 or greater)

However, although it is close, this isn't actually what I was trying to do!

I have found and been trying the following

Code:
`{IF B3>=100 "Thanks" "The minimum order is 100 units"}`
(taken from microsoft http://office.microsoft.com/en-us/wo...005186163.aspx)

However this doesn't work.

Essentially I'm trying to produce a formula that says IF a particular form field is a larger number than 5, display some text.

The examples I've found all seem to use different brackets {}() different methods for displaying strings "xxx" / 'xxx' and different formatting (commas, spaces, equals signs etc). I don't know if this is due to different versions of Word, but it seems quite frustrating compared to the relative simplicity of Excel formulas.

I've tried tweaking my working code as follows, but it hasn't worked as it doesn't seem to like strings:

Code:
`{=IF(B3>=10,high,low)}`

Code:
`{=IF(B3>=10 "high" "low")}`

Code:
`{=IF(B3>=10 'high' 'low')}`

If anyone could point me in the right direction it would be appreciated.

Thanks

2. Assuming your formula is in a cell in the table concerned, you should be able to use any of the following:
{=B3-100 \# "'Thanks';'The minimum order is 100 units'"}
{IF{=B3}< 100 "The minimum order is 100 units" "Thanks"}
{IF{=B3}>= 100 "Thanks" "The minimum order is 100 units"}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message.

To see how to do a wide range of calculations in Word, check out my Microsoft Word Field Maths Tutorial, at:
https://windowssecrets.com/forums/sho...l=1#post320143

3. ## The Following User Says Thank You to macropod For This Useful Post:

metalfury (2012-06-18)

4. Thanks so much macropod

I think the problem is with the 'Field Brace Pairs'

On my version of Word it generates the outer pair itself
Code:
` {IF{=B3}>= 100 "Thanks" "The minimum order is 100 units"}`

The 'auto' generated pair are slightly bolder than the rest of the code. All the other brackets are generated from the keyboard.

So the only code I was able to get to work was:

Code:
`{=B3-100 \# "'Thanks';'The minimum order is 100 units'"}`
(As this is the only one that doesn't contain internal field brace pairs.)

So it turns out that the real issue I'm facing is that I'm using MSWord for Mac and CTRL F9 doesn't work as a method for generating the internal Field Brace Pairs. Do you know if there a menu route that achieves the same result?

Thanks again for your help, as it has helped me to identify the issue. If anyone has experience of trying to place the field brace pairs in MS Word for Mac I would be grateful of any tips!

5. Hi Metalfury,

As I said in my previous post:
The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9.
Evidently, you've been trying to create them via the Insert|Field dialogue, not via Ctrl-F9. And that's why you can't get the nested fields to work - the Insert|Field dialogue can't create them and you're resorting to typed braces. Again, as I said:
you can't simply type them.

6. Hi Paul,

Thanks. Sorry for not being clear, yes I understood from your initial post that typed field braces won't work. However the keyboard (CTRL F9) shortcut doesn't work on an Apple Mac.

I have found a solution though to created nested code

INSERT | FIELD

Code:
`{IF < 100 "The minimum order is 100 units" "Thanks"}`
Then place the cursor where the nested section is required and goto INSERT | FIELD again to add the

Code:
`=B3`
This gives the result

Code:
`{IF{=B3}< 100 "The minimum order is 100 units" "Thanks"}`
I'm not sure if it is the same on the PC, but when you want to view this code you have to right click and select 'Toggle Field Codes' a couple of times to drill down to the nested sections.

Hope this helps anyone else on a Mac

Cheers again, I'm just reading through your Word Document; a fantastic resource!

7. I should have paid more attention to the platform issues - the Mac equivalent of Ctrl-F9 on the PC is Cmd-F9. For other Mac:PC key combo equivalents for fields, see: http://word.mvps.org/mac/FieldsInMacWord.html

8. ## The Following User Says Thank You to macropod For This Useful Post:

metalfury (2012-06-18)

9. Thanks, that's a useful page.

It's a little out of date and Cmd F9 won't work on most Macs. It would be impractical to remove the existing F9 functions on a Mac to reassign them to MS Word. However the method of re-assigning a new keyboard shortcut is much more viable:

Or you can dig the Word commands out of Tools>Customize (look under “All Commands”), and put them on a toolbar or assign a different keyboard shortcut.
So for 'InsertFieldChars' I've now got the shortcut Command+Option+CTRL+F

Happy Days

#### Posting Permissions

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