Primavera P6 Progress Line

kkqazi

New Member
Joined
Dec 21, 2008
Messages
10
Hi,
I am looking to make a Gantt Chart where i can show progress as Primavera P6 progress Line does.
I am attaching picture where its like a snake. Any given time, the bar will either move forward or backward depending on status of activity.

1639168965157.png

any help will be much appreciated.
Thanks
 
Ok, I went hog wild. I hope I don't lose you with this complexity. I added some columns and made the Gantt area formulas with conditional formatting so that they would change with the dates. I changed the macro to work in the column with the same date as the Review Date. The named ranges I added on the sheet are important for the macros. Feel free to ask a thousand questions.

1639272536261.png





test.xlsb
BCEFGHIJKLMNOPQRSTUVWXYZAAABACADAE
5Review Date12/6/2021
6
7Line ItemActionMonthNovemberDecemberJanuaryFebruaryRAG StatusCompletion Date
8WK4546474849505152532345678910
9Beg DateEnd DateTotal DaysDays Past DeadlinePercent VarianceSchedule Type1-Nov 20218-Nov 202115-Nov 202122-Nov 202129-Nov 20216-Dec 202113-Dec 202120-Dec 202127-Dec 20213-Jan 202210-Jan 202217-Jan 202224-Jan 202231-Jan 20227-Feb 202214-Feb 202221-Feb 202228-Feb 2022
101.1Define Objective11/1/202111/14/202113Plan770000000000000000GREEN8-Nov
1111/1/202111/14/2021130100%Actual770000000000000000
121.2Arrange meeting with DM11/1/202111/21/202120Plan777000000000000000GREEN9-Nov
1311/1/202111/21/2021200100%Actual777000000000000000
141.3Explore the time line11/15/202111/21/20216Plan007000000000000000GREEN10-Nov
1511/15/202111/21/202160100%Actual007000000000000000
161.4Assemble Team and Brief11/29/202112/19/202120Plan000077700000000000RED
1712/5/20212/10/20226753365%Actual000017777777774000
181.5Activity 1 - VSM Line11/22/20211/2/202241Plan000777777000000000GREEN6-Dec
1911/22/202112/12/202120-2149%Actual000777000000000000
201.6Activity 2 - Identify Hazards12/1/202112/31/202130Plan000057775000000000AMBER
2111/15/202111/30/202115-31-3%Actual007720000000000000
221.7Activity 3 - Measure hazards12/1/202112/31/202130Plan000057775000000000AMBER
231/5/20222/5/20223136220%Actual000000000577760000
241.8Activity 3 - Identify tolerance1/1/19001/1/19000Plan000000000000000000AMBER
251/1/19001/1/190000 Actual000000000000000000
261.9Activity 4 - Identify Controls1/1/19001/1/19000Plan000000000000000000AMBER
271/1/19001/1/190000 000000000000000000
Gantt
Cell Formulas
RangeFormula
L9:AB9L9=K9+7
K10:AB27K10=MAX(MIN(K$9+6,$F10)-MAX(K$9,$E10)+1,0)
H11,H27,H25,H23,H21,H19,H17,H15,H13H11=IF(G11>0,F11-F10,0)
I11,I27,I25,I23,I21,I19,I17,I15,I13I11=IFERROR(1+(H11/G10),"")
G10:G27G10=IF(AND(E10<>"",F10<>""),F10-E10,0)
Named Ranges
NameRefers ToCells
DateHeaders=Gantt!$K$9:$AB$9L9, K10:K27
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K9:AB9Expression=AND($C$5>=K$9,$C$5<=K$9)textNO
K10:AB27Expression=AND(K10>0,$J10="Actual")textNO
K10:AB27Expression=AND(K10>0,$J10="Plan")textNO



VBA Code:
Sub SnakeLine()

  Dim Cel As Range
  Dim CelHt As Single
  Dim CelLeft As Single
  Dim CelWid As Single
  Dim CelRt As Single
  Dim CelTop As Single
  Dim CelBot As Single
  Dim CelMidVert As Single
  Dim CelMidHorz As Single
  Dim PercVar As Single
  Dim LastPercVar As Single
  Dim LastNode2X As Single
  Dim LastNode2Y As Single
  Dim Node1X As Single
  Dim Node1Y As Single
  Dim Node2X As Single
  Dim Node2Y As Single
  Dim Shp As ShapeRange
  Dim Sht As Worksheet
  Dim X As Long
  Dim Rw As Long
  Dim RevDate As Date
  Dim DateHdrs As Range
  Dim ThisDateHdr As Range
  Dim PercVarCol As Range
  Dim SnakeCol As Range
  Dim GanttArea As Range
  Dim SchedTypeCol As Range
  Dim PV As Variant
  
  Set Sht = Sheets("Gantt")
  Set DateHdrs = Sht.Range("DateHeaders")
  Set PercVarCol = Sht.Range("PercVarCol")
  Set GanttArea = Sht.Range("GanttArea")
  Set SchedTypeCol = Sht.Range("SchedTypeCol")
  RevDate = Sht.Range("ReviewDate").Value
  
  'Find the date over the Gantt Area that matches the Review Date and then set the column for line insertion
  For Each Cel In DateHdrs
    If RevDate >= Cel.Value And RevDate <= Cel.Value + 6 Then
      Set ThisDateHdr = Cel
      Set SnakeCol = Intersect(GanttArea, Cel.EntireColumn)
      Exit For
    End If
  Next Cel
  
  
  
  
  For X = Sht.Shapes.Count To 1 Step -1
    If Left(Sht.Shapes(X).Name, 3) = "Row" Then
      'Debug.Print Sht.Shapes(X).Name
      Sht.Shapes(X).Delete
    End If
  Next X
  
    
  For Each Cel In SnakeCol
    If Intersect(SchedTypeCol, Cel.EntireRow).Value = "Plan" Then  'Only work the Plan Rows
      PV = Intersect(PercVarCol, Cel.Offset(1, 0).EntireRow).Value
      If PV <> "" Then
        PercVar = PV
        CelLeft = Cel.Left
        CelWid = Cel.Width
        CelTop = Cel.Offset(1, 0).Top
        CelMidHorz = CelLeft + (CelWid / 2)
        Rw = Cel.Row
        
        If LastNode2Y = 0 Then
          Node1Y = Cel.Top
        Else
          Node1Y = LastNode2Y
        End If
        
        If LastNode2X = 0 Then
          Node1X = CelMidHorz
        Else
          Node1X = LastNode2X
        End If
        Node2Y = CelTop
        Node2X = CelLeft + ((CelWid * PercVar) / 2)
        X = X
          
        ActiveSheet.Shapes.AddConnector(msoConnectorStraight, Node1X, Node1Y, Node2X, Node2Y).Select
        Set Shp = Selection.ShapeRange
        'Debug.Print Shp.ID
        Shp.Name = "Row" & Rw
        With Shp.Line
          .Visible = msoTrue
          .Weight = 1.75
          .ForeColor.RGB = RGB(255, 0, 0)
          .Transparency = 0
        End With
      
        LastNode2X = Node2X
        LastNode2Y = Node2Y
      End If
    End If
  Next Cel
  
  ThisDateHdr.Select
    
End Sub
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Oh cool. This is exactly I was looking for. You are genius. I just have to set range as you mentioned and I will try. Not feeling well from last night so still in bed resting.
Thanks again. I will check it soon and let you know.

Reg
KK
 
Upvote 0
The snake line is based on how far behind or far ahead the actual schedule is. It compares the number of actual days over the deadline to the number of total planned days. This percentage is applied to the width of the cell for the current review date. If the schedule is on track (100%), then the line will fall in the middle horizontally. If the actual deadline is 50% more time than the planned time, then the line will fall 3/4 to the right of center. If the actual deadline is over by 300%, then the line will fall into the cell to the right of the current date column.

I feel that if you put the line on actual end dates, you may not see where the line ends if it is outside the width of the screen.

If you have questions about the formulas for the Gantt area or the conditional formatting formulas, let me know.

Oh, I forgot, I created a group for columns G,H,I so that I could hide them quickly.
 
Upvote 0
Update

Progress Gantt.xlsm
BCEFJKLMNOPQRSTUVWXYZAAABACADAE
5Review Date12/6/2021
6
7Line ItemActionMonthNovemberDecemberJanuaryFebruaryRAG StatusCompletion Date
8WK4546474849505152532345678910
9Beg DateEnd DateSchedule Type11/1/202111/8/202111/15/202111/22/202111/29/202112/6/202112/13/202112/20/202112/27/20211/3/20221/10/20221/17/20221/24/20221/31/20222/7/20222/14/20222/21/20222/28/2022
101.1Define Objective11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00GREEN11/8/2021
1111/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
121.2Arrange meeting with DM11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00GREEN11/9/2021
1311/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
141.3Explore the time line11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00GREEN11/10/2021
1511/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
161.4Assemble Team and Brief11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00RED
1711/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
181.5Activity 1 - VSM Line11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00GREEN12/6/2021
1911/16/2101/01/22Actual0.000.006.007.007.007.007.007.006.000.000.000.000.000.000.000.000.000.00
201.6Activity 2 - Identify Hazards11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00AMBER
2111/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
221.7Activity 3 - Measure hazards11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00AMBER
2311/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
241.8Activity 3 - Identify tolerance11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00AMBER
2511/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
261.9Activity 4 - Identify Controls11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00AMBER
2711/16/2112/10/21Actual0.000.006.007.007.005.000.000.000.000.000.000.000.000.000.000.000.000.00
Gantt
Cell Formulas
RangeFormula
L9:AB9L9=K9+7
K10:AB27K10=MAX(MIN(K$9+6,$F10)-MAX(K$9,$E10)+1,0)
Named Ranges
NameRefers ToCells
DateHeaders=Gantt!$K$9:$AB$9L9, K10:K27
DatesRange=OFFSET(Gantt!$E$10,0,0,COUNTA(Gantt!$E10:$E10001),2)K10:AB10
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K9:AB9Expression=AND($C$5>=K$9,$C$5<=K$9)textNO
K10:AB27Expression=AND(K10>0,$J10="Plan")textNO
K10:AB27Expression=AND(K10>0,$J10="Actual")textNO




VBA Code:
Sub SnakeLine()

  Dim Cel As Range
  Dim CelHt As Single
  Dim CelLeft As Single
  Dim CelWid As Single
  Dim CelRt As Single
  Dim CelTop As Single
  Dim CelBot As Single
  Dim CelMidVert As Single
  Dim CelMidHorz As Single
  Dim PercVar As Single
  Dim LastPercVar As Single
  Dim LastNode2X As Single
  Dim LastNode2Y As Single
  Dim Node1X As Single
  Dim Node1Y As Single
  Dim Node2X As Single
  Dim Node2Y As Single
  Dim Shp As ShapeRange
  Dim Sht As Worksheet
  Dim X As Long
  Dim Rw As Long
  Dim RevDate As Date
  Dim DateHdrs As Range
  Dim ThisDateHdr As Range
  Dim PercVarCol As Range
  Dim SnakeCol As Range
  Dim GanttArea As Range
  Dim SchedTypeCol As Range
  Dim PV As Variant
  
  Set Sht = Sheets("Gantt")
  Set DateHdrs = Sht.Range("DateHeaders")
  Set PercVarCol = Sht.Range("PercVarCol")
  Set GanttArea = Sht.Range("GanttArea")
  Set SchedTypeCol = Sht.Range("SchedTypeCol")
  RevDate = Sht.Range("ReviewDate").Value
  
  'Find the date over the Gantt Area that matches the Review Date and then set the column for line insertion
  For Each Cel In DateHdrs
    If RevDate >= Cel.Value And RevDate <= Cel.Value + 6 Then
      Set ThisDateHdr = Cel
      Set SnakeCol = Intersect(GanttArea, Cel.EntireColumn)
      Exit For
    End If
  Next Cel
  
  
  
  
  For X = Sht.Shapes.Count To 1 Step -1
    If Left(Sht.Shapes(X).Name, 3) = "Row" Then
      'Debug.Print Sht.Shapes(X).Name
      Sht.Shapes(X).Delete
    End If
  Next X
  
    
  For Each Cel In SnakeCol
    If Intersect(SchedTypeCol, Cel.EntireRow).Value = "Plan" Then  'Only work the Plan Rows
      PV = Intersect(PercVarCol, Cel.Offset(1, 0).EntireRow).Value
      If PV <> "" Then
        PercVar = PV
        CelLeft = Cel.Left
        CelWid = Cel.Width
        CelTop = Cel.Offset(1, 0).Top
        CelMidHorz = CelLeft + (CelWid / 2)
        Rw = Cel.Row
        
        If LastNode2Y = 0 Then
          Node1Y = Cel.Top
        Else
          Node1Y = LastNode2Y
        End If
        
        If LastNode2X = 0 Then
          Node1X = CelMidHorz
        Else
          Node1X = LastNode2X
        End If
        Node2Y = CelTop
        Node2X = CelLeft + ((CelWid * PercVar) / 2)
        X = X
          
        ActiveSheet.Shapes.AddConnector(msoConnectorStraight, Node1X, Node1Y, Node2X, Node2Y).Select
        Set Shp = Selection.ShapeRange
        'Debug.Print Shp.ID
        Shp.Name = "Row" & Rw
        With Shp.Line
          .Visible = msoTrue
          .Weight = 1.75
          .ForeColor.RGB = RGB(255, 0, 0)
          .Transparency = 0
        End With
      
        LastNode2X = Node2X
        LastNode2Y = Node2Y
      End If
    End If
  Next Cel
  
  ThisDateHdr.Select
    
End Sub
 
Upvote 0
Solution
Update

Progress Gantt.xlsm
BCEFJKLMNOPQRSTUVWXYZAAABACADAE
5Review Date12/6/2021
6
7Line ItemActionMonthNovemberDecemberJanuaryFebruaryRAG StatusCompletion Date
8WK4546474849505152532345678910
9Beg DateEnd DateSchedule Type11/1/202111/8/202111/15/202111/22/202111/29/202112/6/202112/13/202112/20/202112/27/20211/3/20221/10/20221/17/20221/24/20221/31/20222/7/20222/14/20222/21/20222/28/2022
101.1Define Objective11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00GREEN11/8/2021
1111/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
121.2Arrange meeting with DM11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00GREEN11/9/2021
1311/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
141.3Explore the time line11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00GREEN11/10/2021
1511/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
161.4Assemble Team and Brief11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00RED
1711/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
181.5Activity 1 - VSM Line11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00GREEN12/6/2021
1911/16/2101/01/22Actual0.000.006.007.007.007.007.007.006.000.000.000.000.000.000.000.000.000.00
201.6Activity 2 - Identify Hazards11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00AMBER
2111/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
221.7Activity 3 - Measure hazards11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00AMBER
2311/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
241.8Activity 3 - Identify tolerance11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00AMBER
2511/16/2111/29/21Actual0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00
261.9Activity 4 - Identify Controls11/16/2111/29/21Plan0.000.006.007.001.000.000.000.000.000.000.000.000.000.000.000.000.000.00AMBER
2711/16/2112/10/21Actual0.000.006.007.007.005.000.000.000.000.000.000.000.000.000.000.000.000.00
Gantt
Cell Formulas
RangeFormula
L9:AB9L9=K9+7
K10:AB27K10=MAX(MIN(K$9+6,$F10)-MAX(K$9,$E10)+1,0)
Named Ranges
NameRefers ToCells
DateHeaders=Gantt!$K$9:$AB$9L9, K10:K27
DatesRange=OFFSET(Gantt!$E$10,0,0,COUNTA(Gantt!$E10:$E10001),2)K10:AB10
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K9:AB9Expression=AND($C$5>=K$9,$C$5<=K$9)textNO
K10:AB27Expression=AND(K10>0,$J10="Plan")textNO
K10:AB27Expression=AND(K10>0,$J10="Actual")textNO




VBA Code:
Sub SnakeLine()

  Dim Cel As Range
  Dim CelHt As Single
  Dim CelLeft As Single
  Dim CelWid As Single
  Dim CelRt As Single
  Dim CelTop As Single
  Dim CelBot As Single
  Dim CelMidVert As Single
  Dim CelMidHorz As Single
  Dim PercVar As Single
  Dim LastPercVar As Single
  Dim LastNode2X As Single
  Dim LastNode2Y As Single
  Dim Node1X As Single
  Dim Node1Y As Single
  Dim Node2X As Single
  Dim Node2Y As Single
  Dim Shp As ShapeRange
  Dim Sht As Worksheet
  Dim X As Long
  Dim Rw As Long
  Dim RevDate As Date
  Dim DateHdrs As Range
  Dim ThisDateHdr As Range
  Dim PercVarCol As Range
  Dim SnakeCol As Range
  Dim GanttArea As Range
  Dim SchedTypeCol As Range
  Dim PV As Variant
 
  Set Sht = Sheets("Gantt")
  Set DateHdrs = Sht.Range("DateHeaders")
  Set PercVarCol = Sht.Range("PercVarCol")
  Set GanttArea = Sht.Range("GanttArea")
  Set SchedTypeCol = Sht.Range("SchedTypeCol")
  RevDate = Sht.Range("ReviewDate").Value
 
  'Find the date over the Gantt Area that matches the Review Date and then set the column for line insertion
  For Each Cel In DateHdrs
    If RevDate >= Cel.Value And RevDate <= Cel.Value + 6 Then
      Set ThisDateHdr = Cel
      Set SnakeCol = Intersect(GanttArea, Cel.EntireColumn)
      Exit For
    End If
  Next Cel
 
 
 
 
  For X = Sht.Shapes.Count To 1 Step -1
    If Left(Sht.Shapes(X).Name, 3) = "Row" Then
      'Debug.Print Sht.Shapes(X).Name
      Sht.Shapes(X).Delete
    End If
  Next X
 
   
  For Each Cel In SnakeCol
    If Intersect(SchedTypeCol, Cel.EntireRow).Value = "Plan" Then  'Only work the Plan Rows
      PV = Intersect(PercVarCol, Cel.Offset(1, 0).EntireRow).Value
      If PV <> "" Then
        PercVar = PV
        CelLeft = Cel.Left
        CelWid = Cel.Width
        CelTop = Cel.Offset(1, 0).Top
        CelMidHorz = CelLeft + (CelWid / 2)
        Rw = Cel.Row
       
        If LastNode2Y = 0 Then
          Node1Y = Cel.Top
        Else
          Node1Y = LastNode2Y
        End If
       
        If LastNode2X = 0 Then
          Node1X = CelMidHorz
        Else
          Node1X = LastNode2X
        End If
        Node2Y = CelTop
        Node2X = CelLeft + ((CelWid * PercVar) / 2)
        X = X
         
        ActiveSheet.Shapes.AddConnector(msoConnectorStraight, Node1X, Node1Y, Node2X, Node2Y).Select
        Set Shp = Selection.ShapeRange
        'Debug.Print Shp.ID
        Shp.Name = "Row" & Rw
        With Shp.Line
          .Visible = msoTrue
          .Weight = 1.75
          .ForeColor.RGB = RGB(255, 0, 0)
          .Transparency = 0
        End With
     
        LastNode2X = Node2X
        LastNode2Y = Node2Y
      End If
    End If
  Next Cel
 
  ThisDateHdr.Select
   
End Sub
Brilliant. all is working now :)
thanks for all the support and guidance along the way.
 
Upvote 0
Brilliant. all is working now :)
thanks for all the support and guidance along the way.
The marked solution has been changed accordingly.

@kkqazi - in your future questions, please mark the solution post instead of your last post to help future readers.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top