+ Reply to Thread
Results 1 to 6 of 6

Conditional Concatenate

Hybrid View

Guest Conditional Concatenate 04-18-2006, 07:10 AM
Guest RE: Conditional Concatenate 04-18-2006, 07:30 AM
Guest RE: Conditional Concatenate 04-18-2006, 07:50 AM
Guest RE: Conditional Concatenate 04-18-2006, 07:45 AM
Guest Re: Conditional Concatenate 04-18-2006, 08:00 AM
Guest Re: Conditional Concatenate 04-18-2006, 09:10 AM
  1. #1
    Martin
    Guest

    RE: Conditional Concatenate

    How about a UDF? Paste this into a VBA module in your workbook and then
    enter into B7:
    =CondConcat(B1:B5)

    Function CondConcat(myRange As Range) As String
    Application.Volatile
    Dim myCell As Range
    For Each myCell In myRange
    If myCell.Value Then
    CondConcat = CondConcat & myCell.Offset(0, -1).Value
    End If
    Next
    End Function


    "ExcelMonkey" wrote:

    > Can anybody tell me how to do a conditional concatenate. I have to columns
    > of data. Column A has numbers: 1-5 (A2:A6). Column B has booleans:
    > TRUE/FALSE (B2:B6)
    >
    > A B
    > 1 TRUE
    > 2 FALSE
    > 3 TRUE
    > 4 FALSE
    > 5 TRUE
    >
    > in B7 I want to do an conditional concatenate using "&" character on column
    > A using the booleans in column B. The result would like like this: &1&3&5.
    > Note there is a "&" before the first number as well.
    >
    > Thanks


  2. #2
    ExcelMonkey
    Guest

    RE: Conditional Concatenate

    Thanks. I actually posted this in the wrong discussion group. I actually
    want to avoid using a UDF if possible. Otherwise, I will consider this.

    Thanks for your time.

    "Martin" wrote:

    > How about a UDF? Paste this into a VBA module in your workbook and then
    > enter into B7:
    > =CondConcat(B1:B5)
    >
    > Function CondConcat(myRange As Range) As String
    > Application.Volatile
    > Dim myCell As Range
    > For Each myCell In myRange
    > If myCell.Value Then
    > CondConcat = CondConcat & myCell.Offset(0, -1).Value
    > End If
    > Next
    > End Function
    >
    >
    > "ExcelMonkey" wrote:
    >
    > > Can anybody tell me how to do a conditional concatenate. I have to columns
    > > of data. Column A has numbers: 1-5 (A2:A6). Column B has booleans:
    > > TRUE/FALSE (B2:B6)
    > >
    > > A B
    > > 1 TRUE
    > > 2 FALSE
    > > 3 TRUE
    > > 4 FALSE
    > > 5 TRUE
    > >
    > > in B7 I want to do an conditional concatenate using "&" character on column
    > > A using the booleans in column B. The result would like like this: &1&3&5.
    > > Note there is a "&" before the first number as well.
    > >
    > > Thanks


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1