Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
New Function: ConcatenateIF
I previously posted a question looking for a Concatenate function similar to
SumIF. This is my solution: Public Function ConcatenateIF(Lookup_Value_Range As Range, _ Match_Range As Range, _ Concatenate_Range As Range) As String Dim x As Long Dim Lookup_Value As String Dim Source_Cell As Range Dim Lookup_Row_Count As Long Set Source_Cell = Application.Caller Lookup_Value = Lookup_Value_Range _ .Cells(Source_Cell.Row - Lookup_Value_Range.Row + 1, 1).Value ConcatenateIF = "" If Lookup_Value < 0 Then Lookup_Row_Count = Match_Range.Rows.Count For x = 1 To Lookup_Row_Count If Lookup_Value = Match_Range.Cells(x, 1).Value _ And Concatenate_Range.Cells(x, 1).Value < 0 Then If ConcatenateIF = "" Then ConcatenateIF = Concatenate_Range.Cells(x, 1).Value Else ConcatenateIF = ConcatenateIF & Chr(10) & Concatenate_Range.Cells(x, 1).Value End If End If Next x End If End Function ----------------------------------------- Thanks Simon Shaw www.simontools.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) | Excel Worksheet Functions | |||
A "ConcatenateIF" Function in Excel | Excel Worksheet Functions | |||
Offset function with nested match function not finding host ss. | Excel Worksheet Functions | |||
Is there a "concatenateif" type function? (>30 options) in Excel | Excel Worksheet Functions | |||
Emulate Index/Match combo function w/ VBA custom function | Excel Worksheet Functions |