Hi there,
not having found a suitable set of excel formulas solving my issue ad-hoc, I went ahead looking into Macros. This is what I want to do:
- CONCATENATE a set of fields in one column
- IF the field in the colum left of my text-field matches a certain criteria
Basically replicating the checking functionality of SUMIF, just with concatenate.
I have found relevant VBA-snippets that I have tried to combine. However, I am lacking the criteria-checking functionality. Here is what I got:
Function JoinIF(source As Range, checkrange As Range, criterion As String, Optional delimiter As String) As String
Dim sResult As String
Dim oCell As Range
Dim cCell As Range
For Each oCell In source.Cells
If Len(oCell.Value) > 0 Then
If cCell.Value = criterion Then
sResult = sResult + CStr(oCell.Value) + delimiter
End If
End If
Next
Join = sResult
End Function
This naturally does't work, as I am not checking the correct cCell value (second IF-Check).
Hence my question: How can I get the correct cCell to check against in the game here?
Thank you for your help!
Best regards,
Andreas
Bookmarks