« All around the world tonight | Main | How to open MS Project from Excel »

Microsoft Project Tip - Formulas and the IIF statement

IIF(immediate if) statements are one of the most commonly used functions in ms project formulas. An IIF statement is basically a condensed version of the "If ...Then .. Else" statement which is often used in programming. The iif statement takes three arguments:

IIf( expression, truepart, falsepart )

The first is the expression you want to evaluate. It needs to be constructed so that it has a true or false answer so it is commonly used to compare vs. a particular value. (see this article for comparing with "NA" ). What the iif statement does next is dependent on whether the result is true or false.

If the expression is true then the truepart is returned. This sounds quite simple and can be very simple. You could return something like a text value or a number. However, the power of the iif statement is that the truepart can be another expression, even another iif statement. This allows you to construct and test many parameters in a single formula.

If the expression is false then the falsepart is returned. Like the truepart it can be an expression or set of nested expressions.

The difficult part of constructing a good nested iif statement is to put the tests in the correct order. Once the statement follows a path to the end, any other ends are not evaluated. The second limitation is that custom field formulas are limited to 256 characters so be economical with your text.

The IIF statement is also available in Excel for cell formulas, but in more recent versions of Excel (XP, 2003, perhaps 2000) it is called the If statement with exactly the same syntax.

  • MS Project Tip - Creating User-defined Filters
  • New Fields in Microsoft Project 2010
  • Project 2010 Tips and Tricks Webcast
  • Date Math - DateAdd, ProjDateAdd in Microsoft Project
  • Views and Tables in Microsoft Project
  • Project Server 2010 Technical Requirements
  • Project Server OLAP Views Errors
  • Microsoft Project Undo Levels and Macros
  • Making the move from VBA to VSTO in Microsoft Project
  • Analyze Microsoft Project Resource Usage Data In Excel

  • Comments (1)


    How do you force the project to have a changeable start date, but keep the duration for the tasks the same? I'm working with a DR project that has a fixed duration of 48 hours for certain tasks to be completed -- this is the maximum allowed time for the tasks no matter when the project actually starts (i.e. the start of the project may be any time, but when a disaster is invoked, the clock starts running at that time for the 48 hour duration for the tasks)

    Post a comment

    (Comments are moderated to fight SPAM and will be published after I have a chance to approve them. Thanks for waiting.)


    The previous article is All around the world tonight.

    The next article is How to open MS Project from Excel.

    Current articles are in the main index page and you can find a complete list of articles in the archives.

    Creative Commons License
    This weblog is licensed under a Creative Commons License.
    Powered by
    Movable Type 3.34