1

I am trying to modify a reference to only show a certain number of characters of text on the left of the string. To test my formula, I used the following field text:

{ =LEFT( "BLAH12345" , 3 ) }

When I update the field, I get the result, "!Syntax Error, :". I've tried multiple combinations of spaces, quotes, etc., and I can't get it to work. It seems like this should be something relatively simple. any thoughts?

3
  • 1
    Welcome to Super User. I don't think that is how field codes are used. There doesn't appear to be a field code in your formula. Can you give us the original field code you were using before modifying it?
    – CharlieRB
    Dec 2, 2015 at 21:23
  • Thank you! I had this: { =LEFT("{ REF _Ref436832789 }", 10) }, which produces the expected result for the nested field, but produces an error when the formula is toggled to view the result.
    – Ian
    Dec 2, 2015 at 21:38
  • 1
    I just don't field codes work that way. Unfortunately, I haven't been able to find anything to back me up. Do you have something that you were following which instructed you to build the field code that way?
    – CharlieRB
    Dec 2, 2015 at 21:56

2 Answers 2

1

The = field doesn't let you use 'any old VBA function'. It only has arithmetic/logical operators and functions (such as MAX, MIN, SUM, PRODUCT etc.) It does not have any text or date/time functions or operators.

You can find a list of the available functions and operators here .

[Except that there are one or two things missing from that description - in Word, the = field does also have an IF function ( { =IF(a,b,c) }, although it is missing from the ECMA and ISO standards, and the description of table references is incomplete].

Unfortunately, there is no other field type in Word that will reliably do what you want. You can "nearly" use a DATABASE field to do it, but that is complicated, will introduce a paragraph mark that you cannot get rid of in modern versions of Word, will not work on Mac word (or online versions, AFAIK), and will fail if for example the text you are LEFTing contains a " (or perhaps ') character.

0

To follow up: I ended up just manually bookmarking the text I wanted to reference. To do this, highlight the source text, and go to Insert>Links group>Bookmark. This allowed me to reference the text I wanted, but is not as clean of a solution as I was hoping for.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .