Forum Discussion
Create text string from input
- Dec 12, 2018
Are you familiar with User Defined Functions? I believe the function below would do what you are after.
Function PeriodString(PeriodStart As Integer, PeriodEnd As Integer, Factor As String)
Dim i As Integer
For i = PeriodStart To PeriodEnd
If i = PeriodEnd Then
PeriodString = PeriodString & i & "|" & Factor
ElsePeriodString = PeriodString & i & "|" & Factor & ";"
End If
Next i
End Function
In case this is not clear perhaps if I present it in a spreadsheet format
A B C D
Period Start Period End Factor Text String
4 6 0.5 4|0.5;5|0.5;6|0.5
The text string needs to return each individual period in the range 4 through 6 and concatenate a "|" together with the factor and ";" after each individual period.
Hopefully this helps
Are you familiar with User Defined Functions? I believe the function below would do what you are after.
Function PeriodString(PeriodStart As Integer, PeriodEnd As Integer, Factor As String)
Dim i As Integer
For i = PeriodStart To PeriodEnd
If i = PeriodEnd Then
PeriodString = PeriodString & i & "|" & Factor
Else
PeriodString = PeriodString & i & "|" & Factor & ";"
End If
Next i
End Function