Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-18-2023, 08:16 PM
newcomer@flounder.com's Avatar
newcomer@flounder.com newcomer@flounder.com is offline Syntax Error in computed field Windows 11 Syntax Error in computed field Office 2021
Novice
Syntax Error in computed field
 
Join Date: Sep 2023
Location: Pittsburgh, PA, USA
Posts: 3
newcomer@flounder.com is on a distinguished road
Default Syntax Error in computed field

Following the instructions that I found, I wanted to get an approximate word count (rounded to 100), so I put in the suggested formula,

Code:
Approximately {=ROUND({NUMWORDS},-2) \# ,0,} words
but when I toggle the field codes, I get



Code:
  Approximately!Syntax Error, {words
I am using Office 365.

Various attempts including the very detailed document on expressions in Word (Word Field Maths V1_5.doc) did not clarify this problem.


So I went back and just replaced the field. I selected the format #,##0, as a number, and got
Code:
NUMWORDS  \# "#,##0" \* Arabic  \* MERGEFORMAT
and got
Code:
Approximately 3107 words

instead of the expected
Code:
Approximately 3,107 words

Last edited by newcomer@flounder.com; 09-18-2023 at 08:33 PM. Reason: Did not get comma on second attempt, so added that
Reply With Quote
  #2  
Old 09-18-2023, 09:53 PM
Guessed's Avatar
Guessed Guessed is offline Syntax Error in computed field Windows 10 Syntax Error in computed field Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

try this
{=Round({Numwords},-2) \# "#,##0"}
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 09-18-2023, 10:54 PM
newcomer@flounder.com's Avatar
newcomer@flounder.com newcomer@flounder.com is offline Syntax Error in computed field Windows 11 Syntax Error in computed field Office 2021
Novice
Syntax Error in computed field
 
Join Date: Sep 2023
Location: Pittsburgh, PA, USA
Posts: 3
newcomer@flounder.com is on a distinguished road
Default Didn't work

Same syntax error message
Reply With Quote
  #4  
Old 09-19-2023, 12:01 AM
Guessed's Avatar
Guessed Guessed is offline Syntax Error in computed field Windows 10 Syntax Error in computed field Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

It works on my M365 machine.

Did you insert both sets of the {parentheses} by using Ctrl-F9?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 09-19-2023, 12:44 AM
newcomer@flounder.com's Avatar
newcomer@flounder.com newcomer@flounder.com is offline Syntax Error in computed field Windows 11 Syntax Error in computed field Office 2021
Novice
Syntax Error in computed field
 
Join Date: Sep 2023
Location: Pittsburgh, PA, USA
Posts: 3
newcomer@flounder.com is on a distinguished road
Default

If I add {} around the body,
Code:
Approximately {
Code:
{=Round({Numwords},-2) \# "#,##0"} } words
or
Code:
Approximately {
Code:
{{=Round({Numwords},-2) \# "#,##0"}} } words
I get
Code:
Approximately  words
Here is exactly what I see when I toggle field codes:

Code:
Approximately {
Code:
=Round({Numwords},-2) \# "#,##0" } words
Please show meexactly what I should see in my file.

(For reasons I do not understand, a gratuitous end-CODE, start-CODE pair are added each time I save this, right after the open brace, which results in really stupid-looking output. I've tried three times to fix it, and the bugs in the editor seem to be permanent)


Last edited by newcomer@flounder.com; 09-19-2023 at 01:02 AM. Reason: Adding text for the failing examples
Reply With Quote
  #6  
Old 09-19-2023, 01:25 AM
Guessed's Avatar
Guessed Guessed is offline Syntax Error in computed field Windows 10 Syntax Error in computed field Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

see attached doc
Attached Files
File Type: docx Wordcount rounding.docx (12.9 KB, 3 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #7  
Old 09-19-2023, 08:41 AM
Charles Kenyon Charles Kenyon is offline Syntax Error in computed field Windows 11 Syntax Error in computed field Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Look at the field in Andrew's document. You cannot simply type the { } field delimiters; Word must put them in, in pairs.
Reply With Quote
Reply

Tags
fields, fields word functions



Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax Error in computed field What is the syntax error with .Text "^p" ? Tom1956 Word VBA 5 09-21-2020 09:24 PM
Syntax error on formula that works in spreadsheet Mxthomp Excel Programming 1 11-02-2016 06:49 PM
Mail Merge Field - Trying to divide time however receiving !Syntax, ; Jake0254 Mail Merge 1 09-24-2014 12:58 AM
Error handling in formula - suppress 'Syntax Error' Cosmo Word 7 02-24-2014 07:08 AM
Using multiple formulas in one (IF, AND and SUM) gives syntax error markdeniet Word 1 02-05-2014 05:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:26 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft