Rnd Function in Custom Field

S

Scott D

I am trying to create a custom field that will round up or just simply round
off the duration of the tasks. I’ve found the syntax for the round function,
Rnd(number), I've tried the following syntax scenarios Rnd(Duration) which
yields "0 days". What I want to use is Duration Variance but it will not
allow the following syntax, Rnd(Duration Variance) I get a message that tells
me the syntax is wrong. I’ve tried Rnd("Duration Variance") and it yields
#ERROR. I’ve tried Rnd([Duration Variance]) and it yields “0 daysâ€. What do
I need to do to the field name to make it work?
 
J

Jan De Messemaeker

Hi,

Rnd is the function that generates a random number beween 0 and 1.
Better use Fix or Int.
 
R

Roger

Try: Round([Duration Variance]/[Minutes Per Day])

Jan De Messemaeker said:
Hi,

Rnd is the function that generates a random number beween 0 and 1.
Better use Fix or Int.

--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
Scott D said:
I am trying to create a custom field that will round up or just simply round
off the duration of the tasks. I've found the syntax for the round function,
Rnd(number), I've tried the following syntax scenarios Rnd(Duration) which
yields "0 days". What I want to use is Duration Variance but it will not
allow the following syntax, Rnd(Duration Variance) I get a message that tells
me the syntax is wrong. I've tried Rnd("Duration Variance") and it yields
#ERROR. I've tried Rnd([Duration Variance]) and it yields "0 days". What do
I need to do to the field name to make it work?
 
J

Jan De Messemaeker

Hi,

I can't find Round in the MS project custom field function list, nor in the
help.
The urprising thing is: it works.

--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
Roger said:
Try: Round([Duration Variance]/[Minutes Per Day])

Jan De Messemaeker said:
Hi,

Rnd is the function that generates a random number beween 0 and 1.
Better use Fix or Int.

--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
Scott D said:
I am trying to create a custom field that will round up or just simply round
off the duration of the tasks. I've found the syntax for the round function,
Rnd(number), I've tried the following syntax scenarios Rnd(Duration) which
yields "0 days". What I want to use is Duration Variance but it will not
allow the following syntax, Rnd(Duration Variance) I get a message
that
tells
me the syntax is wrong. I've tried Rnd("Duration Variance") and it yields
#ERROR. I've tried Rnd([Duration Variance]) and it yields "0 days".
What
do
I need to do to the field name to make it work?
 
J

John

Jan De Messemaeker said:
Hi,

Rnd is the function that generates a random number beween 0 and 1.
Better use Fix or Int.

Scott,
A couple of added comments. If you are using a spare duration field for
your custom field, the Fix or Int functions will not work. I'm not sure
why but they just don't - it may have something to do with the
formatting applied to spare duration fields. A spare text field will
work fine although you will need to apply a factor if for example you
want the value in days, (Project stores all time related information in
minutes, so to convert to days a factor of 490 must be used).

If you really want a rounded value instead of a truncated value, use the
rounding function. It is not listed as being available for custom field
formulas, but it will work. The syntax is:
Text1 = Round([Duration Variance]/480)

Hope this helps,
John
Project MVP
--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
Scott D said:
I am trying to create a custom field that will round up or just simply round
off the duration of the tasks. I've found the syntax for the round function,
Rnd(number), I've tried the following syntax scenarios Rnd(Duration) which
yields "0 days". What I want to use is Duration Variance but it will not
allow the following syntax, Rnd(Duration Variance) I get a message that tells
me the syntax is wrong. I've tried Rnd("Duration Variance") and it yields
#ERROR. I've tried Rnd([Duration Variance]) and it yields "0 days". What do
I need to do to the field name to make it work?
 
S

Scott D

First ya'll are quick to respond, I appreciate the help.

But, its still not working (for me).

Fix and Int aren't producing any change at all, my days are still going out
to a decimal place.

Round([Duration Variance]/[Minutes Per Day]) divides my days by 480 and
reduces them to fractions of days unless the task exceeds 480 days.

Text1 = Round([Duration Variance]/480) yields "0 days" in all tasks.

I've tried Round([Duration Variance]) and I get not change, I've tried
placing a comma and a zero or a whole number after [Duration Variance], like
you would in a spreadsheet and nothing changes. Could there be something in
the customization of the project that needs to be checked? If you haven't
notice by now, I'm still new at using this program.
 
J

Jan De Messemaeker

Hi,

We all should have been more explicit.
The reason some of the "solutions" offered work and others don't is that
Project KEEPS durations in minutes, but inDuration columns SHOWS them as
whatever you like (default days). So when you use any formula, the values in
there are inevitably in minutes.
So let's say you have a duration variance of 2,25 days or 600 minutes.
When your formula is Round([Duration Variance]) it is calculated to 600
(which is round so cannot be rounded) and displayed again a 2,25
The only solution thus consists of dividing duration variance by 480 (or to
be more precise, should you have a day definition other than 8 hours, by
Minutes Per Day, a value to be found under Field, Project, Number) and round
the result.
That works perfectly when you put iy IN A NUMBER FIELD because a number
foeld will not try to display it in any other unit than what is calculated.
The value shown will be 2.
However, in a duration field, Project will convert this value of 2
(remember, if it's duration, it is interpreted as minutes) into days and
show you 0 because rounded at 2 decimals it's les than 0,01.
So if you want the result in a duration field you have to do the conversion
the other way around again and the formula will be:

[Minutes Per Day]*Round([Duration Variance]/[Minutes Per Day])

That's it..

Greetings,

--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
Scott D said:
First ya'll are quick to respond, I appreciate the help.

But, its still not working (for me).

Fix and Int aren't producing any change at all, my days are still going out
to a decimal place.

Round([Duration Variance]/[Minutes Per Day]) divides my days by 480 and
reduces them to fractions of days unless the task exceeds 480 days.

Text1 = Round([Duration Variance]/480) yields "0 days" in all tasks.

I've tried Round([Duration Variance]) and I get not change, I've tried
placing a comma and a zero or a whole number after [Duration Variance], like
you would in a spreadsheet and nothing changes. Could there be something in
the customization of the project that needs to be checked? If you haven't
notice by now, I'm still new at using this program.







--
And they said this would be easy


Scott D said:
I am trying to create a custom field that will round up or just simply round
off the duration of the tasks. I've found the syntax for the round function,
Rnd(number), I've tried the following syntax scenarios Rnd(Duration) which
yields "0 days". What I want to use is Duration Variance but it will not
allow the following syntax, Rnd(Duration Variance) I get a message that tells
me the syntax is wrong. I've tried Rnd("Duration Variance") and it yields
#ERROR. I've tried Rnd([Duration Variance]) and it yields "0 days". What do
I need to do to the field name to make it work?
 
S

Scott D

Jan

Thanks for simplifying it for me. It worked exactly like I wanted it to.
I've got to quit treating the functions as if I were in a spreadsheet.

Scott
--
And they said this would be easy


Jan De Messemaeker said:
Hi,

We all should have been more explicit.
The reason some of the "solutions" offered work and others don't is that
Project KEEPS durations in minutes, but inDuration columns SHOWS them as
whatever you like (default days). So when you use any formula, the values in
there are inevitably in minutes.
So let's say you have a duration variance of 2,25 days or 600 minutes.
When your formula is Round([Duration Variance]) it is calculated to 600
(which is round so cannot be rounded) and displayed again a 2,25
The only solution thus consists of dividing duration variance by 480 (or to
be more precise, should you have a day definition other than 8 hours, by
Minutes Per Day, a value to be found under Field, Project, Number) and round
the result.
That works perfectly when you put iy IN A NUMBER FIELD because a number
foeld will not try to display it in any other unit than what is calculated.
The value shown will be 2.
However, in a duration field, Project will convert this value of 2
(remember, if it's duration, it is interpreted as minutes) into days and
show you 0 because rounded at 2 decimals it's les than 0,01.
So if you want the result in a duration field you have to do the conversion
the other way around again and the formula will be:

[Minutes Per Day]*Round([Duration Variance]/[Minutes Per Day])

That's it..

Greetings,

--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
Scott D said:
First ya'll are quick to respond, I appreciate the help.

But, its still not working (for me).

Fix and Int aren't producing any change at all, my days are still going out
to a decimal place.

Round([Duration Variance]/[Minutes Per Day]) divides my days by 480 and
reduces them to fractions of days unless the task exceeds 480 days.

Text1 = Round([Duration Variance]/480) yields "0 days" in all tasks.

I've tried Round([Duration Variance]) and I get not change, I've tried
placing a comma and a zero or a whole number after [Duration Variance], like
you would in a spreadsheet and nothing changes. Could there be something in
the customization of the project that needs to be checked? If you haven't
notice by now, I'm still new at using this program.







--
And they said this would be easy


Scott D said:
I am trying to create a custom field that will round up or just simply round
off the duration of the tasks. I've found the syntax for the round function,
Rnd(number), I've tried the following syntax scenarios Rnd(Duration) which
yields "0 days". What I want to use is Duration Variance but it will not
allow the following syntax, Rnd(Duration Variance) I get a message that tells
me the syntax is wrong. I've tried Rnd("Duration Variance") and it yields
#ERROR. I've tried Rnd([Duration Variance]) and it yields "0 days". What do
I need to do to the field name to make it work?
 
J

Jan De Messemaeker

Hi Scott,

You're welcome.
And I doin't know whether easy is the word, but by all means

- it is NOT a spreadsheet indeed
- and it is rarely "intuitive"

Greetz,

--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
Scott D said:
Jan

Thanks for simplifying it for me. It worked exactly like I wanted it to.
I've got to quit treating the functions as if I were in a spreadsheet.

Scott
--
And they said this would be easy


Jan De Messemaeker said:
Hi,

We all should have been more explicit.
The reason some of the "solutions" offered work and others don't is that
Project KEEPS durations in minutes, but inDuration columns SHOWS them as
whatever you like (default days). So when you use any formula, the values in
there are inevitably in minutes.
So let's say you have a duration variance of 2,25 days or 600 minutes.
When your formula is Round([Duration Variance]) it is calculated to 600
(which is round so cannot be rounded) and displayed again a 2,25
The only solution thus consists of dividing duration variance by 480 (or to
be more precise, should you have a day definition other than 8 hours, by
Minutes Per Day, a value to be found under Field, Project, Number) and round
the result.
That works perfectly when you put iy IN A NUMBER FIELD because a number
foeld will not try to display it in any other unit than what is calculated.
The value shown will be 2.
However, in a duration field, Project will convert this value of 2
(remember, if it's duration, it is interpreted as minutes) into days and
show you 0 because rounded at 2 decimals it's les than 0,01.
So if you want the result in a duration field you have to do the conversion
the other way around again and the formula will be:

[Minutes Per Day]*Round([Duration Variance]/[Minutes Per Day])

That's it..

Greetings,

--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
Scott D said:
First ya'll are quick to respond, I appreciate the help.

But, its still not working (for me).

Fix and Int aren't producing any change at all, my days are still
going
out
to a decimal place.

Round([Duration Variance]/[Minutes Per Day]) divides my days by 480 and
reduces them to fractions of days unless the task exceeds 480 days.

Text1 = Round([Duration Variance]/480) yields "0 days" in all tasks.

I've tried Round([Duration Variance]) and I get not change, I've tried
placing a comma and a zero or a whole number after [Duration
Variance],
like
you would in a spreadsheet and nothing changes. Could there be
something
in
the customization of the project that needs to be checked? If you haven't
notice by now, I'm still new at using this program.







--
And they said this would be easy


:

I am trying to create a custom field that will round up or just
simply
round
off the duration of the tasks. I've found the syntax for the round function,
Rnd(number), I've tried the following syntax scenarios Rnd(Duration) which
yields "0 days". What I want to use is Duration Variance but it
will
not
allow the following syntax, Rnd(Duration Variance) I get a message
that
tells
me the syntax is wrong. I've tried Rnd("Duration Variance") and it yields
#ERROR. I've tried Rnd([Duration Variance]) and it yields "0 days". What do
I need to do to the field name to make it work?
 

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