Guide · 2026-11-10

Code a Gantt Chart in Excel: 6 Steps With Formulas and Dates

A Gantt chart can turn a list of tasks into a schedule you can understand at a glance. But building one in Excel can feel fiddly: dates shift, bars misalign, and a small formula error can hide important work.

Here’s the truth: you can create a useful chart with six steps, a finish-date formula, and conditional formatting. You don’t need a charting add-in or complex macros.

In this guide, I’ll show you how to code a Gantt chart in Excel, from laying out task dates to coloring the timeline. You’ll also learn how to check the formulas and adapt the chart when plans change.

How to Build a Gantt Chart in Excel: Six Steps

Start with a task list, add start and finish dates, then use a calendar grid and conditional formatting to draw each task bar. The example below uses daily dates, but you can adapt the same setup for weeks.

Step 1: Set Up the Task Columns

Open a blank Excel sheet and create these headings in row 6:

Enter your project tasks in rows 7 through 12. For example, you might list Requirements, Design, Build, Review, Launch, and Training. Add a start date and duration for each task.

Enter duration as a number of calendar days. If a task runs from June 2 through June 4, its duration is three days, including the first and last days.

Step 2: Calculate Each Finish Date

In cell D7, enter this formula:

=B7+C7-1

The subtraction accounts for the start date counting as day one. For a task starting June 2 with a duration of three days, the formula returns June 4.

Copy the formula down column D for each task. Format columns B and D as dates using Excel’s date-format options, so the results are easy to read.

Step 3: Create the Calendar Timeline

Leave columns F onward for the timeline. In F4, enter:

=MIN($B$7:$B$12)

This finds the earliest task start date. In G4, enter =F4+1, then drag the fill handle right to add one date per column.

Format the dates in row 4 as m/d or d-mmm. Freeze the top rows and first columns if you want the task names and timeline headings to stay visible while scrolling.

Step 4: Add Conditional Formatting for the Bars

Select the calendar area for your tasks, such as F7:BA12. Choose Conditional Formatting, create a new rule that uses a formula, and enter:

=AND(F$4>=$B7,F$4<=$D7)

Choose a fill color for the rule. Excel will color a cell when its date falls between that task’s start and finish dates. The dollar signs keep the date row fixed while the task-row references adjust.

When the rule is applied, a task starting June 2 and finishing June 4 should show a three-cell bar across those dates. If the bar begins one day early or late, check the cell references and the finish-date formula.

Step 5: Make the Schedule Easy to Scan

Apply a consistent date format to row 4, widen the task column, and use a clear fill color for the bars. Add borders or light shading to separate task rows without making the calendar hard to read.

You can also use status labels such as “Not started,” “In progress,” and “Complete.” For example, a completed task can retain its planned bar while its status makes progress visible.

Step 6: Test the Dates and Adjust the View

Change a task’s start date and confirm that its bar moves. Then change its duration and check that the finish date and bar length update together.

If your project spans many weeks, switch to weekly columns. In the timeline row, use a formula such as =F4+7 to advance by seven days. Label each column with the week’s starting date.

Finally, add a small legend explaining your colors. This helps someone new to the schedule understand the bars without asking what each shade means.

What the Gantt Chart Formulas Are Doing

The finish-date formula connects duration to the calendar. In =B7+C7-1, Excel adds the duration to the start date and subtracts one because the start day is included.

The conditional-formatting formula checks each timeline cell against the task’s date range. For example, if a cell’s calendar date is June 3 and the task runs from June 2 to June 4, the condition is true and Excel colors the cell.

Here’s why the reference marks matter: F$4 fixes the timeline row, while $B7 and $D7 fix the start and finish columns. The task row can still change as the rule applies downward.

Excel stores dates as serial values, so date arithmetic works directly. If a result looks wrong, check that the start date is recognized as a date and the duration is a number, rather than text.

Choose a Daily or Weekly Timeline

A daily timeline is useful for short projects with specific handoffs. A two-week website launch, for example, may need daily visibility around testing, approvals, and release day.

For a six-month project, daily columns can make the chart too wide to use comfortably. Weekly columns provide a cleaner overview, especially when task dates are estimates rather than firm commitments.

To use weekly columns, set each new timeline date seven days after the previous one. Keep in mind that the conditional-formatting rule then marks a week when its displayed date falls within the task’s start and finish range. For longer tasks, you may want to use each week’s ending date or adjust the rule to match your reporting convention.

Make the Schedule More Useful for Your Team

A Gantt chart shows when work is planned, but it does not explain every decision. Add a short status field or an owner column so people can see who is responsible and whether a task needs attention.

For example, a “Review” task might have a named owner and an “In progress” status. That makes the chart more actionable than a colored bar alone, particularly when several people are coordinating handoffs.

Keep task names concise and split work into a manageable level of detail. “Build checkout page” is easier to schedule than a broad label such as “Website,” while dozens of tiny tasks can make the chart difficult to maintain.

Keep Dates and Bars in Sync

When a task changes, update its start date or duration rather than painting cells manually. The finish-date formula and conditional formatting can then recalculate the bar automatically.

If you insert task rows, extend the conditional-formatting range so the new rows are included. If you add tasks beyond row 12, update the minimum-date formula too; otherwise, the timeline may start at the wrong point.

For a recurring review, check that every task has a valid start date and a positive duration. A blank start date or a duration entered as text can produce missing bars or unexpected dates.

ONES.com Solution: Coordinate Project Work Beyond Excel

ONES.com product screenshot

Value Proposition

Excel can be a practical way to build a lightweight Gantt chart, especially for a small project. When multiple teams need shared schedules, connected knowledge, and ongoing status updates, ONES.com brings project management and knowledge management together in one platform.

ONES Project handles project and task management, while ONES Wiki supports team knowledge management. They are sold separately, so you can choose the capability that fits your work.

Core Capabilities

ONES.com offers a free plan for up to 30 seats. Its cloud and self-hosted versions have feature parity, which can help teams evaluate deployment needs without giving up features solely because of that choice.

Application Scenarios

A growing product team: A team that began with an Excel schedule can move task coordination into ONES Project as planning, reporting, and sprint work become more involved. Jira-compatible workflows may also help when the team already uses Jira-style processes.

A team with restricted network requirements: An organization that needs project management in a controlled environment can consider On-Premise, Private Cloud, or Air-gapped deployment options. The choice depends on its operational and security requirements.

A project with important internal guidance: A team that maintains process guidance alongside project tasks can use ONES Wiki for knowledge management and ONES Project for project work. Since they are sold separately, teams can adopt the relevant product independently.

Common Challenges When Coding a Gantt Chart

Frequently Asked Questions

Can I make a Gantt chart in Excel without an add-in?

Yes. You can build a basic Gantt chart with task dates, a calendar timeline, and conditional formatting. The formula =B7+C7-1 calculates each finish date, while a conditional-formatting rule colors dates within the task range. An add-in is unnecessary for this simple setup, though larger or more specialized projects may need dedicated project-management features.

What formula calculates a task’s finish date?

If the start date is in column B and the duration in days is in column C, use =B7+C7-1 in the finish-date cell. The subtraction includes the start date as the first day of work. For a task starting June 2 with a three-day duration, the finish date is June 4. Copy the formula down for the remaining task rows.

How do I make the Gantt bars update when dates change?

Use conditional formatting with a formula that compares each calendar date against the task’s start and finish dates. For a timeline starting in column F, use =AND(F$4>=$B7,F$4<=$D7). Apply it to the timeline cells for all task rows. When you change a task date or duration, Excel recalculates the finish date and refreshes the bar.

Should I use daily or weekly columns?

Choose daily columns when the project is short or depends on precise handoffs. Use weekly columns when the schedule spans several months or when task dates are approximate. A weekly view is more compact, but it shows less detail. For example, a two-week release plan may benefit from daily columns, while a six-month rollout is often easier to review by week.

Conclusion

You can code a practical Gantt chart in Excel with six steps: organize task details, calculate finish dates, build a timeline, apply conditional formatting, improve readability, and test the results.

When dates or durations change, let the formulas redraw the bars instead of coloring cells by hand. That small habit reduces errors and keeps the schedule easier to maintain.

If a simple project needs a quick visual plan, Excel may be enough. If coordination, reporting, workflows, or deployment requirements grow, consider whether a project-management platform such as ONES.com better fits the work. Start with the amount of detail your team needs, then choose the approach you can keep current.