I made a document in Excel 2010, but the functionality that I hope to get from it seems impossible (at least not with Excel functions by default), and I don't know enough about VB programming for make my own UDF. (I actually use the one I found on the Internet that does part of what I want, but does not meet all my needs.)
Let me break it:
I have several sheets with field groups where users can add numbers (some will be empty, some will contain one number, some will contain several comma-separated numbers)
I have a “Browse” sheet in which I want to combine these numbers (and remove any duplicates) in several different sections (looking only at certain groups of fields).
I found ConcatIf UDF that works well enough for this, however it cannot handle undeveloped cells for concatenation (for example, I want to merge and remove duplicates from D30, G30, J30 and M30 cells together) (Here UDF :)
Function ConcatIf(ByVal compareRange As Range, ByVal xCriteria As Variant, Optional ByVal stringsRange As Range, _
Optional Delimiter As String, Optional NoDuplicates As Boolean) As String
Dim i As Long, j As Long
With compareRange.Parent
Set compareRange = Application.Intersect(compareRange, Range(.UsedRange, .Range("a1")))
End With
If compareRange Is Nothing Then Exit Function
If stringsRange Is Nothing Then Set stringsRange = compareRange
Set stringsRange = compareRange.Offset(stringsRange.Row - compareRange.Row, _
stringsRange.Column - compareRange.Column)
For i = 1 To compareRange.Rows.Count
For j = 1 To compareRange.Columns.Count
If (Application.CountIf(compareRange.Cells(i, j), xCriteria) = 1) Then
If InStr(ConcatIf, Delimiter & CStr(stringsRange.Cells(i, j))) <> 0 Imp Not (NoDuplicates) Then
ConcatIf = ConcatIf & Delimiter & CStr(stringsRange.Cells(i, j))
End If
End If
Next j
Next i
ConcatIf = mid(ConcatIf, Len(Delimiter) + 1)
End Function
It also cannot process "multiple numbers in one cell" as separate numbers.
Is there a way to make UCF Concatenate, which “analyzes” the cells it is looking at, look for duplicates between multiple number cells and single number cells, and then output the result? It is preferable to allow it to accept a number of non-consecutive cells for work (through different sheets).
, , , .:
:
:
:
: