Maximum Formula Size in Custom Field

S

SRL

What is the maximum character size for a formula in a custom field? I've got
a very long iif statement that I think is failing due to formula length, but
I'm not sure.

I'm using Project 2003 Standard.

Thanks,

SRL
 
J

John

SRL said:
What is the maximum character size for a formula in a custom field? I've got
a very long iif statement that I think is failing due to formula length, but
I'm not sure.

I'm using Project 2003 Standard.

Thanks,

SRL

SRL,
One of the problems with formulas, especially long ones, is the
propensity for entry error when creating them. They are also extremely
difficult to troubleshoot. I have two suggestions. Either break the
single long winded formula into multiple formulas spread across multiple
custom fields (easier to troubleshoot and easier to maintain), or use
VBA.

Hope this helps.
John
Project MVP
 
J

Jim Aksel

Try lots of (parenthesis) to make sure your logic is exactly what you think
it is.
--
If this post was helpful, please consider rating it.

Jim
It''s software; it''s not allowed to win.

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
 
N

nvafiades

I am having the same problem. I'm trying to use a switch statement that is
very long and i get a syntax error even though this is correct. Has anyone
offered an explanation?

Example:
This works:
Switch([Number1]=1,'07/03/07',[Number1]=2,'07/03/07',[Number1]=3,'07/03/07',[Number1]=4,'07/03/07',[Number1]=5,'07/03/07',[Number1]=6,'07/03/07',[Number1]=7,'07/03/07',[Number1]=8,'07/03/07',[Number1]=9,'07/03/07',[Number1]=10,'07/03/07',[Number1]=11,'07/03/07',[Number1]=12,'07/03/07',[Number1]=13,'07/03/07',[Number1]=14,'07/03/07')

But this doesnt:
Switch([Number1]=1,'07/03/07',[Number1]=2,'07/03/07',[Number1]=3,'07/03/07',[Number1]=4,'07/03/07',[Number1]=5,'07/03/07',[Number1]=6,'07/03/07',[Number1]=7,'07/03/07',[Number1]=8,'07/03/07',[Number1]=9,'07/03/07',[Number1]=10,'07/03/07',[Number1]=11,'07/03/07',[Number1]=12,'07/03/07',[Number1]=13,'07/03/07',[Number1]=14,'07/03/07',[Number1]=15,'07/03/07',[Number1]=16,'07/03/07')
 
J

John

nvafiades said:
I am having the same problem. I'm trying to use a switch statement that is
very long and i get a syntax error even though this is correct. Has anyone
offered an explanation?

Example:
This works:
Switch([Number1]=1,'07/03/07',[Number1]=2,'07/03/07',[Number1]=3,'07/03/07',[N
umber1]=4,'07/03/07',[Number1]=5,'07/03/07',[Number1]=6,'07/03/07',[Number1]=7
,'07/03/07',[Number1]=8,'07/03/07',[Number1]=9,'07/03/07',[Number1]=10,'07/03/
07',[Number1]=11,'07/03/07',[Number1]=12,'07/03/07',[Number1]=13,'07/03/07',[N
umber1]=14,'07/03/07')

But this doesnt:
Switch([Number1]=1,'07/03/07',[Number1]=2,'07/03/07',[Number1]=3,'07/03/07',[N
umber1]=4,'07/03/07',[Number1]=5,'07/03/07',[Number1]=6,'07/03/07',[Number1]=7
,'07/03/07',[Number1]=8,'07/03/07',[Number1]=9,'07/03/07',[Number1]=10,'07/03/
07',[Number1]=11,'07/03/07',[Number1]=12,'07/03/07',[Number1]=13,'07/03/07',[N
umber1]=14,'07/03/07',[Number1]=15,'07/03/07',[Number1]=16,'07/03/07')
nvafiades,
To be honest I don't know what the limit is. Normally I would expect the
limit to be a power of 2, (i.e. 256, 512, etc.), however your first
formula is 334 characters and the second is 382 characters.

I played with variations on your formula and didn't have any success.
For example I substituted Text1 for Number1 to cut down on the number of
characters in the formula string. The only thing that seemed to matter
is the number of arguments in the Switch statement. However when I
emulated your formula in a VBA macro, it worked fine (i.e. all 16
arguments worked). Nonetheless from what I can tell It appears the
Switch statement in a formula may be limited to 14 arguments although I
couldn't find any written confirmation on that.

Since long winded formulas can be very frustrating to enter and
troubleshoot, when I have to use a long formula I either break the logic
into multiple pieces in more than one spare customized field or I use
VBA. Unless someone else has a better explanation, I suggest you break
your long formula into multiple parts.

John
Project MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top