+ Reply to Thread
Results 1 to 3 of 3

Need VBA Code to Update status of Action assigned for KRA Metrics

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-21-2011
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2007,2010,2016
    Posts
    695

    Need VBA Code to Update status of Action assigned for KRA Metrics

    Dear experts

    i need VBA code to fill average from column L:L of Team and Lead,

    i have rawdata for calculating metrics points of KRA, i want get change status E & L Depends upon criteria

    i want update in E & L E= Status & L=Score card Pts


    J&K
    if Start Date and End Date with in ETA Date Start and End Date Status = Completed and Scord is = 1
    if Start Date and End Date with in After ETA Date Start and End Date But Status = Completed and Score is =.8
    if Start Date and End Date Not with ETA End Date Status = InCompleted and Score = .5
    and

    calculating Points of Average for the month table in Metrics Sheet

    find the attachment
    Attached Files Attached Files
    Last edited by breadwinner; 07-30-2023 at 05:27 PM. Reason: explanation

  2. #2
    Registered User
    Join Date
    06-29-2022
    Location
    Canada
    MS-Off Ver
    2021
    Posts
    38

    Re: Need VBA Code to Update status of Action assigned for KRA Metrics

    Sub FillAverage()
        Dim ws As Worksheet
        Dim lastRow As Long
        Dim teamCol As Integer
        Dim leadCol As Integer
        Dim metricCol As Integer
        Dim team As String
        Dim lead As String
        Dim sum As Double
        Dim count As Long
        Dim average As Double
        
        ' Set the worksheet containing the raw data
        Set ws = ThisWorkbook.Worksheets("Sheet1") ' Replace "Sheet1" with your actual sheet name
        
        ' Define the column numbers for Team, Lead, and the metric you want to calculate the average for
        teamCol = 2 ' Column B (replace with the appropriate column number)
        leadCol = 3 ' Column C (replace with the appropriate column number)
        metricCol = 12 ' Column L (replace with the appropriate column number)
        
        ' Find the last row of data in column L
        lastRow = ws.Cells(ws.Rows.Count, metricCol).End(xlUp).Row
        
        ' Loop through each row and calculate the average for each unique combination of Team and Lead
        For i = 2 To lastRow ' Assuming the data starts in row 2 and headers are in row 1
            
            ' Get the Team and Lead values for the current row
            team = ws.Cells(i, teamCol).Value
            lead = ws.Cells(i, leadCol).Value
            
            ' Initialize sum and count variables for each unique combination of Team and Lead
            sum = 0
            count = 0
            
            ' Loop through the data and calculate the sum and count for the current Team and Lead combination
            For j = 2 To lastRow
                If ws.Cells(j, teamCol).Value = team And ws.Cells(j, leadCol).Value = lead Then
                    sum = sum + ws.Cells(j, metricCol).Value
                    count = count + 1
                End If
            Next j
            
            ' Calculate the average for the current Team and Lead combination
            If count > 0 Then
                average = sum / count
            Else
                average = 0 ' Handle the case where there are no data points for the combination
            End If
            
            ' Fill the calculated average in columns E and L for the current row
            ws.Cells(i, metricCol - 10).Value = average ' Column E
            ws.Cells(i, metricCol).Value = average ' Column L
        Next i
    End Sub

  3. #3
    Forum Contributor
    Join Date
    07-21-2011
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2007,2010,2016
    Posts
    695

    Re: Need VBA Code to Update status of Action assigned for KRA Metrics

    HI sir, can u try with my example file,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Action Status with Multiple Critera
    By Amy Anib in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-27-2022, 09:22 PM
  2. [SOLVED] Need code for automatic status update
    By Regina HR in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-07-2022, 07:29 AM
  3. [SOLVED] Trouble with nested IF to create an action items status column
    By miketomei in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-12-2021, 01:04 PM
  4. Replies: 8
    Last Post: 07-29-2020, 04:16 PM
  5. [SOLVED] Recorded macros start w action. Hand written has code before action. Difference it makes?
    By ILoveStMartin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2020, 08:13 PM
  6. [SOLVED] Pull the G:G column values depends upon status of Awaiting for FS action IN AV:AV vba
    By johnodys in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2014, 02:18 AM
  7. send email via excel for action items with overdue status
    By xiaotianshi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2007, 11:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1