Thanks for complying with the rules ... resistance is futile

Option Explicit

Sub Test()

Dim sh As Worksheet
Dim myRange As Range
Dim lLR As Long
Dim vArray As String
Dim vIndex As Long

vArray = "A:BE"
vIndex = 57

Set sh = Sheets("temp_for_calcs")
Set myRange = sh.Columns("c:c") 'setting range for countif of variable length column
With Sheets("temp_for_calcs")
    lLR = .Range("C" & .Rows.Count).End(xlUp).Row
    .Range("D2").Formula = "=countif(b:b,c2)"
    .Range("E2:E" & lLR).Formula = "=IFERROR(VLOOKUP(c2,flag_matrix!" & vArray & "," & vIndex & ",FALSE),""unknown"")" ' <<<<<<<< here i want to edit so the a:be / 57 are replaced by variables v_array and v_index
    .Range("F2:F" & lLR).Formula = "=IF(e2<>""unknown"",d2*e2,""unknown"")"
    .Range("G2:G" & lLR).Formula = "=IF(e2<>""unknown"",d2/$i$2 *100,""unknown"")" '% of total score
    .Range("I2:I" & lLR).Formula = "=sum(d:d)" 'total flag count
End With

End Sub

Regards, TMS