Do you know that we can easily * calculate the critical path for a project using Excel formulas*?

For a long time, it has been tricky to calculate the **Critical Path** using Excel formulas. But thanks to the arrival of new Dynamic Array functionality in Excel, we can now calculate critical path. In this article let me describe the approach with an example.

Put on your hardhats, this one is going to blow your minds.

## What is Critical Path Method (CPM)?

Critical Path Method gives us a framework to analyze and optimize a project plan. Let’s say you have a project with 6 activities, as depicted below. Then we can find a critical path that determines the total duration of the project using Critical Path Method.

The critical path is the longest sequence of tasks that must be completed to execute a project. The tasks on the critical path are called critical activities because if they’re delayed, the whole project completion will be delayed.

## How do you calculate the Critical Path?

To calculate the critical path, you need below details about the project plan:

- Complete list of all planned activities
- Estimated duration for all activities (t)
- Dependencies for each activity

In many real-world scenarios, accurately listing all three of them is impossible. And that is why CPM technique is often criticized.

Once you have all of them, we need to apply **critical path algorithm **to calculate below 5 values.

- Earliest Starting time (ES): This is maximum Earliest Finish (EF) of all predecessors of an activity.
- Earliest Finish time (EF): This is ES + duration of the activity (t)
- Latest Finish time (LF): This is the minimum Latest Start time (LS) of all successors of an activity.
- Latest Starting time (LS): This is LF – duration of the activity (t)
- Float or Slack (F): This is the gap between Latest Start (LS) and Earliest Start (ES). For activities on
this value would be 0.**critical path**

Learn more about Critical Path Method:

## Critical Path Calculations with an Example

Let’s go back to our 6 activity project. We can assign durations for each activity like this:

We can use below notation when capturing this data in Excel table.

### Calculating ES, EF, LS, LF & Float with Formulas

Adjacent to the input data table, add 6 columns for all our calculations. Our table should look like this:

Now, lets understand the formulas for Successors, Early Start (ES), Early Finish (EF), Latest Start (LS) and Latest Finish (LF).

Early Start Formula (ES)

Early Start is the earliest an activity can begin. An activity can only start when all of its predecessors have finished. So this is same as the * maximum *of

**Early Finish (EF)**for all the predecessors. If an activity has no predecessors, then it can start right away.

As we have the list of predecessors in the cell [@Predecessors], we can loop thru them and find the maximum finish time for them.

Here is the formula I used.

` ````
```=IF([@Predecessors]="",0, MAX(CHOOSEROWS([EF],TEXTSPLIT([@Predecessors],",")+0)))

* For activities without predecessors, *we set the value of ES as 0.

For all other activities, we split the [@Predecessors] by comma (using TEXTSPLIT) and convert these text values to numbers (by adding a 0 to them). We then pick the maximum of all these activity’s earliest finish time [EF] using MAX & CHOOSEROWS functions.

Early Finish Formula (EF)

** This is easy.** We just add duration to early start (ES).

` ````
```=[@ES]+[@[Estimated Duration]]

🤔Did you notice the circular nature of these formulas?

Even though ES formula depends on EF and EF formula depends on ES (head hurts, *innit*?), you need not worry. Excel will calculate both of these values fine as long as there are no **loops *** *in your project data (*ie. *Activity 1 depends on 2 and 2 depends on 1)

Successors Formula

Before we calculate the Latest Start (LS) and Latest Finish (LF) times, it is a good idea to calculate the list of successors for each activity.

I used this formula for that:

` ````
```=TEXTJOIN(",",TRUE,FILTER([ID],IFERROR(BYROW([Predecessors],LAMBDA(a, OR(TEXTSPLIT(a, ",")+0=[@ID]))),FALSE),""))

**How it works?**

For each activity, the list of successors is defined as all the activities that begin immediately after that activity.

So for example, going back to our image of project plan (see below),

the list of successors for * activity 1 *is {2,3}

To obtain this list for a given activity **x:**

- We need to filter all the activities
- where
**x**is one of the predecessors

We can use a cocktail of FILTER(), BYROW(), LAMBDA() and TEXTSPLIT() for this.

Here is the basic approach:

- We filter the [ID] column
- by checking for each row (hence BYROW)
- if the [Predecessor]s has the [@ID]
- To perform the check, we first split the
*predecessors*using TEXTSPLIT - and then compare if any of them equal to [@ID]
- At the end of this BYROW looping, we end up with either TRUE or FALSE values against each [ID]
- After filter fetches all the
*successors,*we just apply TEXTJOIN to combine them to a list. For ex: 2,3

Latest Finish Formula (LF)

**Latest Finish (LF) **is defined as the latest an activity can finish without derailing the project.

**For the activities without any successor****s, **this is same as **EF**.

For all other activities, we look for the minimum (earliest) LS value of all it’s successors.

Here is the formula:

` ````
```=IF([@Successors]="",[@EF],MIN(CHOOSEROWS([LS],TEXTSPLIT([@Successors],",")+0)))

**How this formula works?**

If an activity has no successors (*ie* *it is last activity in the project diagram)* we set LF as EF.

For all other activities, we split the [@Succssors] by comma (using TEXTSPLIT) and convert these text values to numbers (by adding a 0 to them). We then pick the minimum of all these activity’s Latest Start time [LS] using MIN & CHOOSEROWS functions.

Latest Start Formula (LS)

This is Latest Finish (LF) minus Duration (T)

` ````
```=[@LF]-[@[Estimated Duration]]

Float (or Slack)

Now that we have all the calculations done, we can figure out the float (or slack) for each activity. This is the difference between Latest Start (LS) and Earliest Start (ES) for an activity.

` ````
```=[@LS]-[@ES]

## Findout out which activities are on Critical Path

Any activity with ZERO (0) float is on the critical path. It means, there is no wiggle room for that activity.

We can use Excel’s conditional formatting feature to visually identify all such activities.

- Select the table and add a new conditional formatting rule (formula based)
- Use the rule float_column=0 and set the necessary formatting. (see my rule in the below screenshot).

Here is my final project plan table with critical path activities identified.

## Critical Path Analysis with Excel - FREE Template

Please download my FREE Critical Path Analysis Template and use your own data to calculate the **critical path ***automatically.*

## Critical Path Calculations in Excel - Watch the Video

Still confused about these calculations? I made a video explaining the CPM concept & Excel formulas. Check it out below or on my YouTube Channel.

## More on Project Management using Excel

If you are a project manager, you are going to love my site. I have articles & templates on all aspects of Project Management. Check them out below:

## 11 Responses to “Calculating Critical Path using Excel Formulas [Project Management]”

Simpler formula for Successors =TEXTJOIN(",",1,FILTER([ID],ISNUMBER(SEARCH([@ID],[Predecessors])),""))

That is a good one. Unfortunately, once we go beyond 9 activities, the Search function is going to find 1 in id 10 too.

Very nice solution,

but, how to substitute ES, EF, LS, LF with real dates?

You can calculate all the dates by changing the "0" in the ES formula with the actual start date of your project.

Chandoo, it's not true that these formulas work only in Excel for Microsoft 365. New functions: TEXTSPLIT; CHOOSEROWS and LAMBDA also work in Excel for the web.

What doesn't work on the Web is the check box button: "Show Critical Path Activities" or any form control.

To get around that problem when using Excel for the web, manually change cell V3 to TRUE/FALSE.

Great catch Pedro. You can also use a data validation cell to set the "show / hide" options and change the CF rule.

Hi,

I'm interested in your Project Management Templates.

But when I downloaded your "FREE Critical Path Analysis Template" there was a problem.

I found that altering the duration of any activity caused 28 of the 30 calculation cells to show a "#NAME?" error.

what's going wrong?

regards

Kelton

Hello Chandoo,

I want to express my gratitude for introducing the critical path method in Excel. It has proven to be incredibly helpful.

However, I'm currently encountering a challenge. While creating schedules, I adhere to WBS numbering, such as 1.1 and so forth. However, my work packages are further subdivided into activities, and some of my activity numbering includes formats like 1.1.1.

The current formula is not functioning as expected in these cases. Could you please assist by providing an updated formula to handle such IDs? Additionally, I am curious about how the LF and ES calculations would work if a predecessor has more than one ID in a similar format.

Thank you for your assistance.

Hi Chandoo,

i have not been following you for some time and now found you again while searching for VBA tools for CPM.

Great (as alwasy from you) work.

If I may give you, not a comment on the work, but rather some insgight on what is used in real planning work.

Your work considers the schedule will be developed using the "Activity on Arrow" methodology.

In real life no one uses this method. It is the "Basic 101" way to start teaching CPM.

Practically all schedules in real life use the "Activity on Node" methodology which allows much more freedom, but does complicate this a little, since it allows not only "FS" links, but also:

SS (Start»Start);

SF (Start to Finish) (not common but possible);

FF (Finish to Finish)

FS (Finish to Start)

And all these links can have positive or negative lags (X days (positive or negative).

Hope this is useful.

Regards

jose lourenco

Hello Jose,

Do you have logic to form critical chain/Critical path based on below dependencies? Please share.

SS (Start»Start);

SF (Start to Finish) (not common but possible);

FF (Finish to Finish)

FS (Finish to Start)

Hello Chandoo,

Do you have excel with task dependencies (SS,FS,FF & SF)? It will be of great help.