Word calculated field IF condition

didijaba

Well-known Member
Joined
Nov 26, 2006
Messages
511
Hello, I have word template and I am trying to make ti calculate number value based on value in other two legacy text form fields. If field No1 has text "Skye" and field No2 has numeric value (for example) 3 then field no3 should do something like =if(field.no1.text="Skye", 1+field.no2.value, field.no2.value). How to write such formula for calculated legacy text form field? I have tried some with {} and stuff but can not get it to work.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Formfields in word have a bookmark property and a 'calculate on exit' property. Make sure your formfields have valid bookmark names and that their 'calculate on exit' option is checked. Then, where you want the results to appear, insert a set of nested fields, coded as: {={IF{REF Fld1}= "Skye" 1 0}+{=Fld2 \#0} \# 0}

Note: The field brace pairs (i.e. '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues.

To see how to a wide range of calculations in Word, check out my Microsoft Word Field Maths Tutorial, at:
Microsoft Word Field Maths Tutorial | Windows Secrets Lounge
or:
Graham Mayor - Downloads
 
Upvote 0
Formfields in word have a bookmark property and a 'calculate on exit' property. Make sure your formfields have valid bookmark names and that their 'calculate on exit' option is checked. Then, where you want the results to appear, insert a set of nested fields, coded as: {={IF{REF Fld1}= "Skye" 1 0}+{=Fld2 \#0} \# 0}

Note: The field brace pairs (i.e. '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues.

To see how to a wide range of calculations in Word, check out my Microsoft Word Field Maths Tutorial, at:
Microsoft Word Field Maths Tutorial | Windows Secrets Lounge
or:
Graham Mayor - Downloads

Thanks for your detail advise, I will try as you have instructed. Thanks once again :-)
 
Upvote 0
I have started reading your manual and it is very good. Did you by any chance write any books on Word?
 
Upvote 0
I have started reading your manual and it is very good. Did you by any chance write any books on Word?
Thank you. No, I haven't written any books. I have written some more tutorials, though.

To see how to do just about everything you might want to do with dates in Word, check out my Microsoft Word Date Calculation Tutorial, at:
Microsoft Word Date Calculation Tutorial | Windows Secrets Lounge
or:
Graham Mayor - Downloads

To see how to use use Word's Catalogue/Directory Mailmerge facility for gouping records in a mailmerge, with any mailmerge data source supported by Word, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial at:
Microsoft Word Catalogue/Directory Mailmerge Tutorial | Windows Secrets Lounge
or:
http://www.gmayor.com/Zips/Catalogue Mailmerge.zip
The tutorial covers everything from list creation to the insertion & calculation of values in multi-record tables in letters. Do read the tutorial before trying to use the mailmerge document included with it.

For some worked examples, see the attachments to the posts at:
mail merge with duplicate names but different dollar amounts
Access to Word, Creating a list from multiple records
[SOLVED] Word 2010 Merge from excel into Table Directory | Windows Secrets Lounge

A book I contributed content for and did much of the technical review of is The Secret Life of Word: A Professional Writer's Guide to Microsoft Word Automation, by R Delwood, published by XML Press in 2011(The Secret Life of Word « XML Press). This isn't a programming book as such (though it does have some programming in it) and doesn't profess to teach you how to program. Rather, it shows how to combine Word's various tools to achieve whatever the desired result might be. Another book I contributed for (and has much more programming in it) is Word Hacks, by A Savikas, published by O'Reilly Media in 2005 (Word Hacks - O'Reilly Media). Although it pre-dates Office 2007, much of the content is still relevant.
 
Upvote 0

Forum statistics

Threads
1,225,676
Messages
6,186,384
Members
453,351
Latest member
Sarahmaths

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