# Custom Fields - Formulas - Blank Field Problem

• ### Question

• Hi

I am wanting to create a simple custom field that identifies if a task has a predecessor or not. If it has predecessors display 0. If not display 1. The aim is to sum all the tasks within a schedule and see how many activities do not have predecessors.

I have explored the forums and have seen that MS Project represents NA as 1x2^32. (Nasty bit of coding there!!!)

When a predecessor field contains no data and is simply blank (it does not display N/A). So IIf(([[Predecessors]<>2^32),0,1) doesn't work. Also IIf(([[Predecessors]<>,0,1) doesn't work.

I have tried the ISNull formula without satisfactory results. Finally I have IIf(([Predecessors]<>""),0,1) which works but technically I just don't like it. To my mind I am comparing a Integer List with a text data type and I don’t like it.

It’s clumsy!

Are there any other suggestions?

I using Ms Project Professional 2007.

Wednesday, December 15, 2010 3:38 AM

• Hi Reefexplorer

IIf([Predecessors]<>"",1,0) should be the formula to use, as you are not comparing [Int] <> "Str",

predeccesor in background seems to be a string field, as you might see there could be multiple predeccesors to one task for eg 2,3,4SS,5FF so its a string field rather than integer

Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com
Wednesday, December 15, 2010 6:03 AM

### All replies

• Hi Reefexplorer

IIf([Predecessors]<>"",1,0) should be the formula to use, as you are not comparing [Int] <> "Str",

predeccesor in background seems to be a string field, as you might see there could be multiple predeccesors to one task for eg 2,3,4SS,5FF so its a string field rather than integer

Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com
Wednesday, December 15, 2010 6:03 AM
• Thanks Sunil for the answer.

What makes me uneasy is the Predecessor data type is described as an Interger list (see help file). I imagine this is an type of Matrix or array in the database. I am then comparing this with a String field via a boolean expression. Using boolean comparisons for different data types is fragile and it invites bugs into the system.

However, it seems to work on the surface. I was wanting a more solid or technically correct  formula than the one I have above.

Cheers

Chris

Monday, December 20, 2010 12:37 AM