Share via

Microsoft Project - How to avoid using #Error in Cost Custom Field

Anonymous
2016-08-31T02:55:07+00:00

Hello all,

I have created a Simple formula in Custom Field Cost5. 

IIf(Len([Text3])<>0,[Cost2]*CInt(Text3))

The formula works fine when there is a value in Text3. If there is no value I get #ERROR.  Any chance I can avoid that. 

Thank you

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-08-31T09:49:46+00:00

What sort of data are you storing in Text3?  Have you considered using a spare Number field?  By default the number fields have a value of zero - so if you haven't entered data into the field, the formula result will be zero.

Was this answer helpful?

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-08-31T13:28:58+00:00

    SFMJI.

    The formula does not know what to do when Len[Text3] is equal to zero. There is no False part in the iif. Its syntax is iif( condition, true_part, false_part ). iif**( Len([Text3])<>0, [Cost2]*CInt(Text3), ??? )**

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2016-09-06T03:21:38+00:00

    Thank you.

    I am kind a beginner in customizing fields in MS Project to show data on Gantt Chart. I changed text fields to Number and the reports & if  statements work great.

    Thanks for the direction.

    ckandreou:

    My long shot is that converting text to integer by using CInt and using the term "if statements" indicate that you have background in programming. So it won't be difficult to understand how it works with formulas.

    If you like, you can also ask me questions thru email (check profile) and there are many articles **here** on formulas.

    Kind regards.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-09-02T10:22:43+00:00

    You're welcome.  Because a number field cannot be blank, you can greatly simplify the formula.  It can simply be: 

    [Cost2]*[NumberX} .  No need for the IIF to test if the number field is empty.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2016-09-01T12:28:41+00:00

    Thank you.

    I am kind a beginner in customizing fields in MS Project to show data on Gantt Chart. I changed text fields to Number and the reports & if  statements work great.

    Thanks for the direction.

    Was this answer helpful?

    0 comments No comments