Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
MS Word table - problem with conditional formula
I have set up in MS Word a main document and source document, which performs
a mail merge to produce a Form Letter. The mail merge works OK and the appropriate Merge Fields are correctly inserted into the Form Letter. The main document is an advice to individuals and team leaders re competitions they wish to enter and includes a table, the first three columns of which are – Col A – Competition Name, Col B – Accepted and Col C Entry Fee. Row 1 contains the column headings and in Rows 2 to 12 the names of various competitions. In Row 13 cell C13 has the formula: - {=Sum(C2:C12)\#”£#,##0.00;(£#,##0.00)”} and correctly shows the total of any amounts (entered manually) in Col C. I am having problems in getting a conditional formula to work. In Col B an X will signify acceptance of an entry (in the competition for that row) and in Col C the formula is required to calculate the entry fee, which will vary according to the number of people in the team for that competition. I envisage something like: – {=IF B2=X Product (2.90,2)}. With an appropriate number format (#,##0.00) inserted in the formula dialog box this should produce 5.80 in cell C2 provided B2 has X, (or blank if not X), and likewise in other cells in Col C with a similar formula. I know the ‘curly brackets’ have to be inserted by using Ctrl + F9 and not typed in from the keyboard. However all my attempts seem to produce a Syntax Error in cell C2. On one occasion I did manage to update C2 by using F9 but when I removed the X from B2 and did another update the 5.90 remained in C2 (instead of a blank because there was no acceptance for that competition). The following formula: - {IF {B2X,””,{=PRODUCT(2.9,2)\#”#,##0.00”}}} was accepted in C2 without any error message, but when the cell was selected and updated by F9 no result was displayed whether or not B2 had an X. I then tried inserting an = sign before the IF and was rewarded with: - !Unexpected end of formula. All suggestions for resolving this problem gratefully received. |
#2
Posted to microsoft.public.word.tables
|
|||
|
|||
MS Word table - problem with conditional formula
Please can someone tell me what is wrong with the syntax in the following
formula: - {=IF(B3="X",PRODUCT(2.9,2),"")} The ’curly brackets’ (braces) were inserted into the cell using Ctrl + F9. I constructed the formula in the cell originally from the keyboard and got a ! Syntax Error, “ message. I then deleted the formula and constructed the formula in an Excel worksheet and it worked. I then copied the formula to the clipboard, went back to the (Word 2000) document table, inserted the braces into the cell and then pasted the formula between the braces and again got the same error message as before. Does anyone know the significance of the double quotes at the end of the message? From experimenting it seems the problem is to do with the IF condition, because a straightforward function - PRODUCT(2.9,2) - with appropriate number formatting gives the correct result i.e. 5.80 To get the job finished I have had to manually update my Form Letter but would like to get this problem sorted so that I can automate the job next time I use it. Peter -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/200604/1 |
#3
Posted to microsoft.public.word.tables
|
|||
|
|||
MS Word table - problem with conditional formula
I think you're trying to use Excel syntax in Word. Word's syntax would be:
{ IF B3 = "X" { = PRODUCT (2.9,2) } "" } or just { IF B3 = "X" { = 2.9 * 2 } "" } -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Peterkins via OfficeKB.com" u20492@uwe wrote in message news:5e5ece24139be@uwe... Please can someone tell me what is wrong with the syntax in the following formula: - {=IF(B3="X",PRODUCT(2.9,2),"")} The ’curly brackets’ (braces) were inserted into the cell using Ctrl + F9. I constructed the formula in the cell originally from the keyboard and got a ! Syntax Error, “ message. I then deleted the formula and constructed the formula in an Excel worksheet and it worked. I then copied the formula to the clipboard, went back to the (Word 2000) document table, inserted the braces into the cell and then pasted the formula between the braces and again got the same error message as before. Does anyone know the significance of the double quotes at the end of the message? From experimenting it seems the problem is to do with the IF condition, because a straightforward function - PRODUCT(2.9,2) - with appropriate number formatting gives the correct result i.e. 5.80 To get the job finished I have had to manually update my Form Letter but would like to get this problem sorted so that I can automate the job next time I use it. Peter -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/200604/1 |
#4
Posted to microsoft.public.word.tables
|
|||
|
|||
MS Word table - problem with conditional formula
Hi Suzanne
Thanks for your response. If one tries to construct the formula from the Word menu bar - Table Formula, the Formula dialogue appears and any formula constructed appears in the cell with a pair of braces around it. However if one pastes the IF function into the formula line it then appears as "=IF( )" (without the quotes of course). I have been unable to find any way to insert a pair of braces in the formula line. So I have constructed the formula directly in the table cell using Ctrl + F9 to insert the braces then keying in your suggested syntax. The formula was accepted into the cell without any error message, but when I selected the cell and updated it with F9 the cell remained blank even though there was an X in B3. Your alternative also performed similarly. It seems the inclusion of spaces does make a difference. In the following I have put asterisks where spaces occur: - {*IF*B2*=*"X"*{*=*PRODUCT(2.9,2),*}""*} This gives a "no result" i.e. the cell is blank when updated. {*IF*B2="X"*{*=*PRODUCT(2.9,2),*}""*} Removing the spaces either side of the first "=" causes a X to appear in the cell when it is updated. Unfortunately I am no further forward in finding what is wrong with the syntax of my version. Please may I ask you if you have actually tried to get this working on your system; I would be very interested to know. Suzanne S. Barnhill wrote: I think you're trying to use Excel syntax in Word. Word's syntax would be: { IF B3 = "X" { = PRODUCT (2.9,2) } "" } or just { IF B3 = "X" { = 2.9 * 2 } "" } -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/200604/1 |
#5
Posted to microsoft.public.word.tables
|
|||
|
|||
MS Word table - problem with conditional formula
Well, this was pretty bizarre, but here's the answer:
{ IF B2=X { = PRODUCT (2.9,2} "" } That is, remove the quotes around "X." The spaces around the first = are crucial, but none of the other spaces matter, and it works with or without quotes around the IF field. In most case spaces make no difference; Word inserts and in some cases insists on spaces between the field delimiters and the contents; spaces around operators can be more touchy. Also, I realize this is probably just a sample/example/test, but if your actual field were going to be the product of 2.9 and 2, it would make a lot more sense to just put "5.8" instead of { = PRODUCT (2.9,2) }. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Peterkins via OfficeKB.com" u20492@uwe wrote in message news:5e648d56f3b52@uwe... Hi Suzanne Thanks for your response. If one tries to construct the formula from the Word menu bar - Table Formula, the Formula dialogue appears and any formula constructed appears in the cell with a pair of braces around it. However if one pastes the IF function into the formula line it then appears as "=IF( )" (without the quotes of course). I have been unable to find any way to insert a pair of braces in the formula line. So I have constructed the formula directly in the table cell using Ctrl + F9 to insert the braces then keying in your suggested syntax. The formula was accepted into the cell without any error message, but when I selected the cell and updated it with F9 the cell remained blank even though there was an X in B3. Your alternative also performed similarly. It seems the inclusion of spaces does make a difference. In the following I have put asterisks where spaces occur: - {*IF*B2*=*"X"*{*=*PRODUCT(2.9,2),*}""*} This gives a "no result" i.e. the cell is blank when updated. {*IF*B2="X"*{*=*PRODUCT(2.9,2),*}""*} Removing the spaces either side of the first "=" causes a X to appear in the cell when it is updated. Unfortunately I am no further forward in finding what is wrong with the syntax of my version. Please may I ask you if you have actually tried to get this working on your system; I would be very interested to know. Suzanne S. Barnhill wrote: I think you're trying to use Excel syntax in Word. Word's syntax would be: { IF B3 = "X" { = PRODUCT (2.9,2) } "" } or just { IF B3 = "X" { = 2.9 * 2 } "" } -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/200604/1 |
#6
Posted to microsoft.public.word.tables
|
|||
|
|||
MS Word table - problem with conditional formula
Hi Suzanne
This problem seems to be getting even more bizarre. First if I may explain I used the Product function because the Entry Fee can vary from time to time. Because I was trying to get this thing working by taking one step at a time, I used a fixed fee in the formula, but intended to substitute the result of an ASK field into the formula once the formula is made to work properly. My main document has two ASK fields one for a date and the other for the Entry Fee. As you doubtless know, if the whole document is selected (Ctrl + A) and F9 to update, Word displays the prompts for the ASK fields which are then updated along with the results from the formulae in each of the rows in Column C. I used your revised syntax first with the fixed fee and then substituting the ASK field { EntryFee } in the formula and got the correct results with both versions and using various amounts for fees. However once an update had produced a value in C, removing the X from Col B and again updating, the previously calculated value remained in C. I made some further experiments and then found that the calculation is performed whether or not there is an X in Col B!! This is how my formula now looks (* = space): - {*IF*B2=X*{*PRODUCT( {*EntryFee*},2)\#*#0.00*}""*} What further thoughts do you have please? With many thanks for your time and patience. Peter Suzanne S. Barnhill wrote: Well, this was pretty bizarre, but here's the answer: { IF B2=X { = PRODUCT (2.9,2} "" } That is, remove the quotes around "X." The spaces around the first = are crucial, but none of the other spaces matter, and it works with or without quotes around the IF field. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/200604/1 |
#7
Posted to microsoft.public.word.tables
|
|||
|
|||
MS Word table - problem with conditional formula
Hi Peterkins,
A formula in Column C like: {IF B2=X {=2*2.9} \# £,0.00} should give the result you're after. However, this requires hard-coding both the entry fee and the number of entrants. If you set your table up so that Column C has the number of entries, and Column D has the fee per entry, you could use: {IF B2=X {=C2*D2} \# £,0.00} in Column E. For more on Word field maths, check out my Word Field Maths 'tutorial', at: http://www.wopr.com/cgi-bin/w3t/show...?Number=365442 Cheers "Peterkins via OfficeKB.com" u20492@uwe wrote in message news:5e648d56f3b52@uwe... Hi Suzanne Thanks for your response. If one tries to construct the formula from the Word menu bar - Table Formula, the Formula dialogue appears and any formula constructed appears in the cell with a pair of braces around it. However if one pastes the IF function into the formula line it then appears as "=IF( )" (without the quotes of course). I have been unable to find any way to insert a pair of braces in the formula line. So I have constructed the formula directly in the table cell using Ctrl + F9 to insert the braces then keying in your suggested syntax. The formula was accepted into the cell without any error message, but when I selected the cell and updated it with F9 the cell remained blank even though there was an X in B3. Your alternative also performed similarly. It seems the inclusion of spaces does make a difference. In the following I have put asterisks where spaces occur: - {*IF*B2*=*"X"*{*=*PRODUCT(2.9,2),*}""*} This gives a "no result" i.e. the cell is blank when updated. {*IF*B2="X"*{*=*PRODUCT(2.9,2),*}""*} Removing the spaces either side of the first "=" causes a X to appear in the cell when it is updated. Unfortunately I am no further forward in finding what is wrong with the syntax of my version. Please may I ask you if you have actually tried to get this working on your system; I would be very interested to know. Suzanne S. Barnhill wrote: I think you're trying to use Excel syntax in Word. Word's syntax would be: { IF B3 = "X" { = PRODUCT (2.9,2) } "" } or just { IF B3 = "X" { = 2.9 * 2 } "" } -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/200604/1 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
WP merge file to Word | Tables | |||
How can Word display full path of a file in the title bar? | Microsoft Word Help | |||
Formula to Sum values in word table | Mailmerge | |||
Underscore (_) will not always display in RTF files (Word 2002). | Microsoft Word Help | |||
Envelope Address | New Users |