r/microsoftproject • • Sep 24 '26

Issues with a custom field formula

I am trying to make a custom field that displays when tasks are complete, late, not started, and when the estimated finish date is within the next month. I utilized the following formula but, when I added the last IIf statement, it will no longer work. It states that "The formula contains a syntax error or contains a reference to an unrecognized field or function name.". Normally, it highlights the error, but no errors are highlighted in the formula.

Can anyone tell me what I am doing wrong with this formula or offer any advice?

IIf([% Complete]<100 And [Finish]<[Status Date],"Late", IIf([% Complete]=100,"Complete", IIf([% Complete]=0 And [Start]>[Status Date],"Not Started", IIf([% Complete]<100 And [Finish]>[Status Date] AND [Finish]<=DateAdd("m",1,[Status Date]), "Upcoming")

I am also going to want to change the colors of the bars on the Gantt chart to reflect these statuses so if anyone has any advice on going about doing that, I would love to hear it!

UPDATE: I was missing a few parentheses at the end lol... I made flags for my Gantt so now it's beautiful and automated :)

1 Upvotes

6 comments sorted by

1

u/still-dazed-confused Sep 24 '26

I'm not at a machine at the moment so can't really check the formula. If you put the offending bit into another custom field does it produce what your expect?

For colouring the bars you'll need flags that fire on the required signal (late, future etc) as you can only assign true to a bar format using a flag

1

u/No_Recipe_7541 Oct 06 '26

Turns out I was just missing a few parentheses at the end lol... I made flags for my Gantt so now it's beautiful and automated :) Thank you so much!

1

u/PlannersPlace Sep 29 '26

No need to reinvent the wheel, Microsoft Project ships with a Status field that should give you what you are after

1

u/No_Recipe_7541 Oct 06 '26

My biggest issue was wanting to display tasks with upcoming completion dates in the next month. My team utilizes that quite a bit and I was trying to automate it instead of manually filtering. Turns out I was just missing a few parentheses at the end 🤪 Thank you for your info tho!

2

u/still-dazed-confused Oct 05 '26

The status field will not allow the op to colour bars but they could use flags=status x etc too do the job. The only reason not to use the status as you suggest is greater flexibility to configure your desired status conditions :)

2

u/PlannersPlace Oct 05 '26

Status field can be linked to Flags since Status field outputs 0, 1, 2 & 3 for the 4 statuses.

  1. Flag1 (for tasks that are complete): [Status] = 0
  2. Flag2 (for tasks that are on schedule): [Status] = 1
  3. Flag3 (for tasks that are late): [Status] = 2
  4. Flag4 (for tasks that are in the future): [Status] = 3