Complete the formula to calculate the duration between start and end dates in days.
=DATEDIF(A2, [1], "D")
The DATEDIF function calculates the difference between two dates. Here, A2 is the start date and B2 is the end date. The "D" means the difference is in days.
Complete the formula to create a timeline bar length by multiplying duration by a scale factor in cell D1.
=DATEDIF(A2, B2, "D") * [1]
The duration in days is multiplied by the scale factor in D1 to get the length of the timeline bar.
Fix the error in the formula to correctly calculate the timeline start position relative to the project start date in cell A1.
=DATEDIF([1], A2, "D")
The timeline start position is the number of days from the project start date in A1 to the task start date in A2. So, A1 must be the first date in the formula.
Fill both blanks to create a formula that shows the task name from column C with the duration in days if the duration is more than 5 days.
=IF(DATEDIF(A2, B2, "D") [1] 5, [2], "")
The formula checks if the duration is greater than 5 days. If yes, it shows the task name with the duration in days in parentheses.
Fill all three blanks to create a formula that calculates the timeline bar start position, length, and adds a label with task name and duration.
=ARRAYFORMULA(IF(ROW(A2:A) = ROW(A2), "Label", IF(A2:A = "", "", {DATEDIF([1], A2:A, "D"), DATEDIF(A2:A, B2:B, "D") * [2], [3] & " (" & DATEDIF(A2:A, B2:B, "D") & " days)"})))
DATEDIF.This formula uses ARRAYFORMULA to calculate for all rows: the start position as days from project start date A1, the bar length scaled by factor in D1, and a label combining task name in C2:C with duration.