# Calculating duration based on given number.

• ### Question

• Hello all,

as a beginning Project user I immediately run into a problem. I am aiming to use Project for research in cardiac care. I wish to change the duration of the tasks based on the amount of patients participating in a particular study, so that the workload also changes. For example, the task of measuring blood pressure is 5 minutes. With 20 patients, the duration of the task should automatically become 120 minutes. However, I am unable to create a formula for this, because I cannot get a number to multiply a time. In essence, I want to multiply duration with a variable amount. Help would be greatly appreciated.

Tuesday, June 12, 2012 11:38 AM

• Hi,

This cannot be done directly, you will have to write the Formula for it. But, just to add on Project work on Duration, Assignments and Scheduling based on algorithms which gets captured in default fields for rest of the calculation you have to use Custom Fields. So, you might not see the desired calculations in default Duration/Work fields unless you manually punch in the values based on the foreseen workload.

So, either you add approx duration say you expect 10 patients which mean 50 minutes as the duration; later you get 12 patients you can again edit the duration to 1hr. In project, we incrementally change our initial planned values to actual value.

Other process is Custom formula field - but this won't be considered towards default Workload calculation. The tool work differently then EXL.

Create Number 1 Custom Field named as Patients Count[Number 1]. Create Duration 1 Custom Field with Formula- [Number1]*5. This will calculate Duration1 in Days by default. If you want to change it to minutes, go to File -> Options -> Schedule -> Duration entered in -Minutes. Note :  this will make defualt Duration unit as Minutes for entire project.

Sapna S

• Marked as answer by Tuesday, June 12, 2012 2:27 PM
Tuesday, June 12, 2012 12:53 PM
• Hello SJ,

The problem is not the multiplication, when you have a formula in a custom field that can contain multiplications, ebven durations times numbers!

The real problem is that you can only have formulas in custom fields (such as duration5) and not in the duration field. On top of that, when Project does the multiplication, 20 patients times 5 minutes will be calculated as 100 minutes not 120

There are several workarounds such as using VBA but the one you can put to work without programming skills is as follows.

- Put your number of patients in a Number field (let's say Number1)

- Put the unit duration in a free duration field such as duration1. If your default unit of duration is not the minute, you have to code it as 5m

- Insert the field duration2. (instructions for Project 2010). Right-click on the column header, click Custom fields. Click the work Formula. In the formula window enter [Duration1]*[Number1]. Then OK etc. Now duration2 will contain the result you want.

Finally, every now and then, select the values in duration2 and paste them into the duration field.

Greetings,

Tuesday, June 12, 2012 1:09 PM

### All replies

• Hi,

This cannot be done directly, you will have to write the Formula for it. But, just to add on Project work on Duration, Assignments and Scheduling based on algorithms which gets captured in default fields for rest of the calculation you have to use Custom Fields. So, you might not see the desired calculations in default Duration/Work fields unless you manually punch in the values based on the foreseen workload.

So, either you add approx duration say you expect 10 patients which mean 50 minutes as the duration; later you get 12 patients you can again edit the duration to 1hr. In project, we incrementally change our initial planned values to actual value.

Other process is Custom formula field - but this won't be considered towards default Workload calculation. The tool work differently then EXL.

Create Number 1 Custom Field named as Patients Count[Number 1]. Create Duration 1 Custom Field with Formula- [Number1]*5. This will calculate Duration1 in Days by default. If you want to change it to minutes, go to File -> Options -> Schedule -> Duration entered in -Minutes. Note :  this will make defualt Duration unit as Minutes for entire project.

Sapna S

• Marked as answer by Tuesday, June 12, 2012 2:27 PM
Tuesday, June 12, 2012 12:53 PM
• Hello SJ,

The problem is not the multiplication, when you have a formula in a custom field that can contain multiplications, ebven durations times numbers!

The real problem is that you can only have formulas in custom fields (such as duration5) and not in the duration field. On top of that, when Project does the multiplication, 20 patients times 5 minutes will be calculated as 100 minutes not 120

There are several workarounds such as using VBA but the one you can put to work without programming skills is as follows.

- Put your number of patients in a Number field (let's say Number1)

- Put the unit duration in a free duration field such as duration1. If your default unit of duration is not the minute, you have to code it as 5m

- Insert the field duration2. (instructions for Project 2010). Right-click on the column header, click Custom fields. Click the work Formula. In the formula window enter [Duration1]*[Number1]. Then OK etc. Now duration2 will contain the result you want.

Finally, every now and then, select the values in duration2 and paste them into the duration field.

Greetings,

Tuesday, June 12, 2012 1:09 PM
• Thank you both for your answers. Dumb typo from me, ofcourse 5 patients times 20 minutes is 100 minutes. Too bad that it cannot take a value to recalculate. Thought it would be possible, sort of like Excel. I will think about a good solutions, taking your advice into account!
Tuesday, June 12, 2012 2:26 PM