Hello
I am trying to get a one column array containing the the values of a frequency tabble class marks:
I already tried several alternatives, but none of them worked.
I would appreciate help.
Function Y(R1, R2)
Dim fn As WorksheetFunction
Set fn = WorksheetFunction
Dim NR As Integer, N As Integer
Dim C(), F(), cF()
Dim X(), Z()
NR = R1.Rows.Count
N = fn.Sum(R1)
ReDim C(1 To NR), F(1 To NR), cF(1 To NR)
ReDim X(1 To N), Z(1 To N)
For i = 1 To NR
C(i) = R1.Item(i)
F(i) = R2.Item(i)
Next i
cF(1) = F(1)
For i = 2 To NR
cF(i) = cF(i - 1) + F(i)
Next i
For i = 1 To NR
For j = 1 To F(j)
X(j) = C(i)
Next j
Next i
Y = fn.Transpose(X)
End Function
I am trying to get a one column array containing the the values of a frequency tabble class marks:
Raw | C | F | ||
1 | 1 | 2 | #VALUE! | =Y($C$3:$C$5;$D$3:$D$5) |
1 | 2 | 1 | ||
2 | 3 | 2 | ||
3 | ||||
3 |
I already tried several alternatives, but none of them worked.
I would appreciate help.
Function Y(R1, R2)
Dim fn As WorksheetFunction
Set fn = WorksheetFunction
Dim NR As Integer, N As Integer
Dim C(), F(), cF()
Dim X(), Z()
NR = R1.Rows.Count
N = fn.Sum(R1)
ReDim C(1 To NR), F(1 To NR), cF(1 To NR)
ReDim X(1 To N), Z(1 To N)
For i = 1 To NR
C(i) = R1.Item(i)
F(i) = R2.Item(i)
Next i
cF(1) = F(1)
For i = 2 To NR
cF(i) = cF(i - 1) + F(i)
Next i
For i = 1 To NR
For j = 1 To F(j)
X(j) = C(i)
Next j
Next i
Y = fn.Transpose(X)
End Function