Sub A1_FormulaAlterationsV3()
'
Dim RowNumber As Long
Dim ColumnOffset As Long, RowOffset As Long
'
ColumnOffset = 0
RowNumber = 3
RowOffset = 0
'
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset).Formula = "=IFERROR(INDEX($A$3:$I$2000,MATCH($M" & RowNumber & ",$C$3:$C$2000,0),1),"""")"
'
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 1).Formula = "=IFERROR(INDEX($A$3:$I$2000,MATCH($M" & RowNumber & ",$C$3:$C$2000,0),2),"""")"
'
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 2).FormulaArray = "=IFERROR(INDEX($C$3:$C$2000,MATCH(0,COUNTIF($M$2:$M" & RowNumber - 1 & ",($C$3:$C$2000)),0)),"""")" ' This may need to be fixed ;)
'
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 3).Formula = "=IF(IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS(N" & RowNumber + 1 & ":$O" & RowNumber + 1 & ")+1)/2)),4),"""")="""","""")"
'
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 4).Formula = "=IF(M" & RowNumber & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS(O" & RowNumber + 1 & ":$O" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
'
'
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 5).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":P" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 7).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":R" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 9).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":T" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 11).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":T" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 13).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":V" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 15).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":X" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 17).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":Z" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 19).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AB" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 21).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AB" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 23).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AD" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 25).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AF" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 27).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AH" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 29).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AJ" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 31).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AL" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 33).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AN" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 35).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AP" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 37).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AR" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 39).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AT" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 41).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AV" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 43).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AX" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 45).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":AZ" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 47).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":BB" & RowNumber & ")+1)/2)),9),""""))"
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 49).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber & ":BD" & RowNumber & ")+1)/2)),9),""""))"
'
'
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 6).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":Q" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 8).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":S" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 10).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":U" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 12).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":W" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 14).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":Y" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 16).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AA" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 18).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AC" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 20).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AE" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 22).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AG" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 24).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AI" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 26).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AK" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 28).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AM" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 30).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AO" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 32).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AQ" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 34).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AS" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 36).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AU" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 38).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AW" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 40).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":AY" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 42).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":BA" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
Range("K" & RowNumber).Offset(RowOffset, ColumnOffset + 44).Formula = "=IF(M" & RowNumber - 1 & "="","",IFERROR(INDEX($A$3:$I$2000,AGGREGATE(15,6,(ROW($C$3:$C$2000)-ROW($C$2))/($C$3:$C$2000=$M" & RowNumber & "),INT((COLUMNS($O" & RowNumber + 1 & ":BC" & RowNumber + 1 & ")+1)/2)),5),""""))&"""""
End Sub