Now I'm using MS Excel 2019. I desire to make function to get text at Summary Steps column and Sumary Values column from Steps and Values Column
It's described as .
I tried with this function. However, It doesn't work at all
Function Congdoan_Time(Congdoan As Range, Time As Range, gtri As Boolean) As String
Dim xValue, TimeValue As String
Dim xChar As String
Dim xOutValue, xTimeValue As String
xValue = Congdoan.Value
TimeValue = Time.Value
Dim arr, timearr As Variant
Dim text, texttime As String
Dim nextarr As Variant
arr = Split(xValue, ",")
timearr = Split(TimeValue, "-")
Dim i As Long
Dim vallue As Variant
vallue = timearr(0)
For i = LBound(arr) To UBound(arr) - 1
If arr(i) = arr(i + 1) And i < UBound(arr) - 1 Then
vallue = Val(vallue) + Val(timearr(i + 1))
End If
If arr(i) = arr(i + 1) And i = UBound(arr) - 1 Then
End If
If arr(i) <> arr(i + 1) Then
xOutValue = xOutValue & "," & arr(i)
xTimeValue = xTimeValue & "-" & vallue
vallue = Val(timearr(i + 1))
End If
Next i
If xOutValue = "" Then
xOutValue = Join(arr, ",")
xTimeValue = vallue
End If
text = Right(xOutValue, Len(xOutValue) - 1)
nextarr = Split(text, ",")
If arr(UBound(arr)) <> nextarr(UBound(nextarr)) Then
text = text & "," & arr(UBound(arr))
xTimeValue = xTimeValue & "-" & Val(vallue) + Val(timearr(UBound(arr)))
End If
If gtri = True Then
Congdoan_Time = text
Else
Congdoan_Time = xTimeValue
End If
End Function
Formula at Sumary Steps Column
Please help to make another funtion that's work for me Thank you