This is what would be the output
I have this formula in cell "C1" To average the values in column2 with respected to column1 values.It gives what I need to do. But I want to get this work into a vba code.
Can anyone help to put this into a code. Is it possible when we have reference cells in the formula?? or do we need to go to more complex code??
=IF(A2<>A1,AVERAGEIF(A2:INDEX($A2:INDEX(A:A,MATCH(1E+99,A:A)+1),MATCH(TRUE,(INDEX($A2:INDEX(A:A,MATCH(1E+99,A:A)+1)<>A2,)),0)),A2,B2:INDEX($B2:INDEX(B:B,MATCH(1E+99,A:A)+1),MATCH(TRUE,(INDEX($A2:INDEX(A:A,MATCH(1E+99,A:A)+1)<>A2,)),0))),"")