Excel challenge

Gene Khalyapin

New Member
Joined
Jun 25, 2008
Messages
27
I know there must be a solution for this, just can't figure it out:

Row 1 has a set of triggeres (in different columns): 1,0,1,0,1
Row 2 has corresponding values: a,b,c,d,e

I need a formula that would look at triggers and for each trigger equal to 1, it should pick up the values from Row 2 and combines them in one sell. In the example above the desired result should be: "ace"

Is there an expandable formula solution for this?

Thanks!
 
Thank you guys! "string concatenation" is exactly what I need but it looks like there is no easy solution for this and the ones that are available involve Add-in, VBA code or lots of extra data (I had hoped for some easy and neat solution like that Barry's =LOOKUP() function in 2008 Excel challenge;))

Thank you for the help!
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Triggered by DonleyOte's answer in this thread: http://www.mrexcel.com/forum/showthread.php?t=494235

is here an improved version of the formula "wizard":

Code:
Sub makeFormula()
Dim StrFormula As String
Dim rng As Range
Dim cll As Range
On Error Resume Next
 
[B][COLOR=red]Set rng = Application.InputBox("Select the range the formula should apply to:", Type:=8)
[/COLOR][/B]If Not rng Is Nothing Then
    If rng.Columns.Count <= 255 Then
        StrFormula = "=Concatenate("
        For Each cll In rng
            StrFormula = StrFormula & "IF(" & cll.Address & "=1," & cll.Offset(1, 0).Address & "," & """" & """" & "),"
        Next cll
        StrFormula = Left(StrFormula, Len(StrFormula) - 1)
        StrFormula = StrFormula & ")"
        ActiveCell.Formula = StrFormula
    Else
        MsgBox "You have choosen more than 255 columns. No Formula generated."
    End If
Else
    MsgBox "You have not selected a valid range. No Formula generated."
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,632
Messages
6,125,909
Members
449,274
Latest member
mrcsbenson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top