Construct a string based on checked cells

Hoping there's a way in Excel to do this - see picture - I want each column to check for an "x" and if found, append a code at right to a cell at top.  Hopefully the picture is worth a 1000 words (or more).  Not sure what formula, if any can do this... Can vaguely see a VBA way but would rather avoid that.

GroupCreation.PNG
LVL 98
Lee W, MVPTechnology and Business Process AdvisorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gerwin Jansen, EE MVETopic Advisor Commented:
What you are looking for is a concatif function, that checks for non empty values and then concatenates (with an additional semicolon) to the string you want.

PAQ: http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_26884303.html
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee W, MVPTechnology and Business Process AdvisorAuthor Commented:
Great, thanks, I'll check it out.
0
it_saigeDeveloperCommented:
It's possible but it wouldn't be very pretty without some VBA code:Capture.JPGTo explain, the 'G' column becomes your temporary holder for 'C' column values, 'H' for 'D'; etc. etc.
Once you have these values then you can concatenate the holder values -Capture.JPGPersonally, I would use a Function to do all this work for me.  If you want I can whip one up.

-saige-
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

it_saigeDeveloperCommented:
Nevermind on whipping one up, Gerwin's posted PAQ does this nicely. ;)

-saige-
0
it_saigeDeveloperCommented:
Gerwin's posted EE PAQ in action:Capture.JPGRepost of code used from http:/Q_26884303.html -
' Credit to Rory Archibald;
' EE PAQ - http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_26884303.html
Function CONCATENATEIF(Source As Range, Criteria, Target As Range, Optional Delimeter As String = ", ")
    Dim fSource, fTarget
    Dim fRow As Long, fColumn As Long
    If (Source.Rows.Count <> Target.Rows.Count) Or (Source.Columns.Count <> Target.Columns.Count) Then
        CONCATENATEIF = CVErr(xlErrRef)
    Else
        fSource = Source.Value
        fTarget = Target.Value
        For fRow = LBound(fSource, 1) To UBound(fSource, 1)
            For fColumn = LBound(fSource, 2) To UBound(fSource, 2)
                If StrComp(fSource(fRow, fColumn), Criteria, vbTextCompare) = 0 Then
                    CONCATENATEIF = CONCATENATEIF & Delimeter & fTarget(fRow, fColumn)
                End If
            Next fColumn
        Next fRow
        If Len(CONCATENATEIF) > 0 Then
            CONCATENATEIF = Mid$(CONCATENATEIF, Len(Delimeter) + 1)
        Else
            CONCATENATEIF = ""
        End If
    End If
End Function

Open in new window

-saige-
0
Lee W, MVPTechnology and Business Process AdvisorAuthor Commented:
To be clear for others, you have to open the VBA editor, add a new module, and paste the function code from the PAQ in there.  Then it works great.

THANKS!
0
Gerwin Jansen, EE MVETopic Advisor Commented:
You're welcome ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.