Manipulation of sales data

mikeyosyd

New Member
Joined
Apr 18, 2018
Messages
5
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi, I'd really appreciate any suggestions on how best to manipluate the datasheet for a sales pipeline dashboard to enable me to report on sales prospects over time. I specifically want to be able to report on the number and value of sales leads in the pipeline at any point in time, by sales stage. And to compare that between periods. E.g. how many active sales leads do we have in the pipeline for Q1 2023 vs Q1 2022.

There are several sales stages e.g. 0_Early_Stage_Prospecting, 1.Requirements&Quote, 2.SubmittedforApproval, 3.Approved, 4.NotApproved, 5.ProposaltoClient25, 5.ProposaltoClient50, 6.NegotiationFinalStage, 7.Sold, 8.Contracted, 9.QuoteRejected

Right now the data is structured so that each sales opportunity is a row in a spreadsheet and it includes the date it entered the sales pipeline and then the number of days at each of the sales stages.

I can't work out how to manipulate the data to put it into a structure that then allows comparison reporting from one period to another, or at any point in time.

In the mini sheet, I've given an example of what the data looks like from our sales pipeline. I've included 20 dummy rows of data. In the attached image I've included a mocked-up example of one way we might want to report on the data if I can get it into the right format i.e. a stacked area chart showing the value in USD of the sales opportunity by sales stage and date.

Many thanks indeed for any advice.

Sales pipeline data example.xlsx
ABCDEFGHIJKLMNOPQ
2prospect_nocreation_Datecompanyproject_namecurrencyprospect_revenuedays_in_0.EarlyStageProspectingdays_in_1.RequirementsampQuotedays_in_2.SubmittedforApprovaldays_in_3.Approveddays_in_4.NotApproveddays_in_5.ProposaltoClient25days_in_5.ProposaltoClient50days_in_6.NegotiationFinalStagedays_in_7.Solddays_in_8.Contracteddays_in_9.QuoteRejected
34192023-04-27Company 1Project 1USD15000180000000000
44182023-03-26Company 2Project 2USD1000008031200270000
54172023-03-24Company 3Project 3USD23580020020939000
64162023-02-24Company 4Project 4USD1700008000023150034
74152023-02-24Company 5Project 5USD2412501001001015102500
84142023-01-21Company 6Project 6USD30000000003011100
94132023-01-18Company 7Project 7USD20009000002500101
104122023-01-17Company 8Project 8USD75361700200150015510
114112023-01-06Company 9Project 9USD453502200100271060
124102023-01-06Company 10Project 10USD150000900012000000
134092022-12-05Company 11Project 11USD9000000000170211230
144082022-12-04Company 12Project 12USD5250010000281041190
154072022-11-04Company 13Project 13USD106150520088431620
164062022-11-03Company 14Project 14USD1015002000029001620
174052022-11-03Company 15Project 15USD5000002000029001930
184042022-10-03Company 16Project 16USD2490002010014200141640
194022022-09-15Company 17Project 17USD707500213015011041970
204012022-09-14Company 18Project 18USD15500020000290351770
214002022-09-01Company 19Project 19USD45800355014020200000
223992022-08-29Company 20Project 20USD17400000000134341900
23Etc, several hundred rows
Data Extract
 

Attachments

  • Screenshot 2023-05-16 at 17.25.44.png
    Screenshot 2023-05-16 at 17.25.44.png
    96.3 KB · Views: 10

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Turning the data around so that each opportunity is spread over 11 rows enables more flexibility in reporting.

This code will populate another sheet with the data in this structure.

You will need to change these two lines in the code as appropriate.

' This is the worksheet containing the data.
Set Ws = Worksheets("SalesOpportunity")

' This is the worksheet to contain the restructured data. Add a worksheet and call it what you want.
Set WsDestination = Worksheets("SalesOpportunityReporting")

VBA Code:
Public Sub subTransformData()
Dim rngData As Range
Dim s As String
Dim strSite As String

Dim Ws As Worksheet
Dim WsDestination As Worksheet
Dim arrStages() As Variant
Dim intCol As Integer
Dim intRow As Integer
Dim i As Integer
Dim arrData() As Variant

On Error GoTo Err_Handler

    ActiveWorkbook.Save

    ' Change these two lines.
    Set Ws = Worksheets("SalesOpportunity")
    Set WsDestination = Worksheets("SalesOpportunityReporting")
        
    Set rngData = Ws.Range("A2:A" & Ws.Range("A1").CurrentRegion.Rows.Count)
    
    arrData = rngData

    arrStages = Array("Early_Stage_Prospecting", "Requirements&Quote", "SubmittedforApproval", _
        "Approved", "NotApproved", "ProposaltoClient25", "ProposaltoClient50", "NegotiationFinalStage", _
        "Sold", "Contracted", "QuoteRejected")
            
    WsDestination.Cells.ClearContents
    
    WsDestination.Range("A1:F1").Value = Ws.Range("A1:F1").Value
    WsDestination.Range("G1:H1").Value = Array("Stage", "Days")
        
    intRow = 2

    For i = LBound(arrData) To UBound(arrData)
        For intCol = 0 To 10
            With WsDestination
                .Range("A" & intRow).Resize(1, 6).Value = Ws.Range("A" & i + 1).Resize(1, 6).Value
                .Range("G" & intRow).Resize(1, 2).Value = Array(arrStages(intCol), Ws.Range("G" & i + 1).Offset(0, intCol).Value)
            End With
            intRow = intRow + 1
        Next intCol
    Next i
    
    Call subFormatWorksheet(WsDestination)
        
Exit_Handler:

    Exit Sub

Err_Handler:

    MsgBox "There has been an error. the data may not have been transformed properly", vbInformation, "Warning!"

    Resume Exit_Handler

End Sub

Public Sub subFormatWorksheet(Ws As Worksheet)
Dim WsActive As Worksheet

    Set WsActive = ActiveSheet
    
    With Ws.Range("A1").CurrentRegion
        With .Rows(1)
            .Interior.Color = RGB(213, 213, 213)
            .Font.Bold = True
        End With
        .Font.Size = 14
        .Font.Name = "Arial"
        .RowHeight = 30
        .VerticalAlignment = xlCenter
        .IndentLevel = 1
        .EntireColumn.AutoFit
    End With
    
    With Ws.Range("A1").CurrentRegion.Borders
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = vbBlack
    End With

    If Not ActiveWindow.FreezePanes Then
        Ws.Activate
        Range("A2").Select
        ActiveWindow.FreezePanes = True
        Ws.Activate
    End If
        
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,182
Members
452,615
Latest member
bogeys2birdies

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