Advanced Data Analysis
Statistical analysis and data validation
2196 views
Featured
Perfect For:
- Quality control
- Trend analysis
- Outlier detection
VBA Code
Sub AnalyzeDataTrends()
Dim ws As Worksheet
Dim dataRange As Range
Dim lastRow As Long
Dim average As Double
Dim stdev As Double
Set ws = ActiveSheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
Set dataRange = ws.Range("B2:B" & lastRow)
' Calculate statistics
average = Application.WorksheetFunction.Average(dataRange)
stdev = Application.WorksheetFunction.StDev(dataRange)
' Create summary
ws.Range("E1").Value = "Analysis Summary"
ws.Range("E2").Value = "Average: " & Round(average, 2)
ws.Range("E3").Value = "Std Dev: " & Round(stdev, 2)
ws.Range("E4").Value = "Count: " & dataRange.Count
' Highlight outliers
Dim cell As Range
For Each cell In dataRange
If Abs(cell.Value - average) > 2 * stdev Then
cell.Interior.Color = RGB(255, 200, 200)
End If
Next cell
MsgBox "Data analysis complete!"
End Sub
Related Topics
statistics
analysis
outliers
validation
Need Custom VBA Solutions?
Our AI-powered VBA generator can create custom code tailored to your specific requirements in seconds.
Free AI generations every month — top up with credit packs anytime
Related Templates
More VBA templates in the same category
Intermediate
ROI Calculator with Scenarios
Calculate Return on Investment with multiple scenario analysis
View Template