```
Function CreateClusterChartArray(RngInput As Range, ValueToUse As Long, NumberToInsertAtEachDataPoint As Integer, OffsetNumber As Integer, DesiredArrayLength As Integer, AddExtraAtStarAndEnd As Boolean, ColumnOrRow As String) As Variant
'References modArraySupport By Chip Pearson - Thanks Chip!
Dim x As Long
Dim y As Integer
Dim Result As Boolean
Dim Str As String
Dim ArrInputArray()
'A range returns a 2 dimensional range so we need to convert it to 1 for function to work
If UCase(ColumnOrRow) = "COLUMN" Then
ReDim ArrInputArray(RngInput.Rows.Count - 1)
For y = 1 To RngInput.Rows.Count
If IsError(RngInput(y, 1)) = True Then
ArrInputArray(y - 1) = 0
Else
ArrInputArray(y - 1) = RngInput(y, 1)
End If
Next y
Else
ReDim ArrInputArray(RngInput.Columns.Count - 1)
For y = 1 To RngInput.Columns.Count
If IsError(RngInput(1, y)) = True Then
ArrInputArray(y - 1) = 0
Else
ArrInputArray(y - 1) = RngInput(1, y)
End If
Next y
End If
'Str = ""
'For x = LBound(ArrInputArray) To UBound(ArrInputArray)
' Str = Str & " " & ArrInputArray(x)
'Next x
'Debug.Print RngInput.Address & "Before: " & Str
For x = UBound(ArrInputArray) To LBound(ArrInputArray) + 1 Step -1
For y = 1 To NumberToInsertAtEachDataPoint
Result = InsertElementIntoArray(ArrInputArray, x, ValueToUse)
Next y
Next x
'add entry at end
For y = 1 To NumberToInsertAtEachDataPoint
Result = InsertElementIntoArray(ArrInputArray, UBound(ArrInputArray) + 1, ValueToUse)
Next y
'add offset to beginning
For y = 1 To OffsetNumber
Result = InsertElementIntoArray(ArrInputArray, LBound(ArrInputArray), ValueToUse)
Next y
'add extra entry at start and end if required
If AddExtraAtStarAndEnd = True Then
Result = InsertElementIntoArray(ArrInputArray, UBound(ArrInputArray) + 1, ValueToUse)
Result = InsertElementIntoArray(ArrInputArray, LBound(ArrInputArray), ValueToUse)
End If
'cut off or add extra 0 is array not equial to max length
Do While UBound(ArrInputArray) + 1 < DesiredArrayLength
Result = InsertElementIntoArray(ArrInputArray, UBound(ArrInputArray) + 1, ValueToUse)
Loop
Do While UBound(ArrInputArray) + 1 > DesiredArrayLength
Result = DeleteArrayElement(ArrInputArray, UBound(ArrInputArray), True)
Loop
CreateClusterChartArray = ArrInputArray
'Str = ""
'For x = LBound(ArrInputArray) To UBound(ArrInputArray)
' Str = Str & " " & ArrInputArray(x)
'Next x
'Debug.Print RngInput.Address & "After: " & Str
End Function
```