View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ECDNewEngland ECDNewEngland is offline
external usenet poster
 
Posts: 6
Default Return column header within an array when a value is met

Thanks for the feedback. I'm new to macros and need to do some homework.
Really appreciate the quick turn around and idea.

"Sheeloo" wrote:

I am unable to think of a cleaner formula...

Unfortunately concatenate does not accept a list...

You can always do this through a macro...
'---------------------
Sub joinHeadings()
Dim i As Integer
Dim oStr As String
oStr = ""
'Replace 10 by the no of columns you have
For i = 1 To 10
If Cells(2, i).Value = "Yes" Then
oStr = oStr & Cells(1, i).Value
End If
Next i
MsgBox oStr
End Sub
'---------------------
If not then ...
Assuming you have your column headers in Sheet1
then in Sheet2 A1 enter
=IF(Sheet1!A2="Yes",Sheet1!A1,"") and copy across

Then in A2 you can have
=(A1&B1&....) and refer to this cell where you have your HUGE formulae...

It will not change anything but will be cleaner...

--
Always provide your feedback...


"ECDNewEngland" wrote:

Here's an example of one of my template field formula's:

=CONCATENATE((IF(In!$B3="Yes",In!$B$2,"")),(IF(In! $C3="Yes",",
"&In!$C$2,"")),(IF(In!$D3="Yes", ", "&In!$D$2,"")),(IF(In!$E3="Yes",",
"&In!$E$2,"")),(IF(In!$F3="Yes",", "&In!$F$2,"")),(IF(In!$G3="Yes",",
"&In!$G$2,"")),(IF(In!$N3="Yes",", "&In!$N$2,"")),(IF(In!$O3="Yes",",
"&In!$O$2,"")),(IF(In!$P3="Yes",", "&In!$P$2,"")),(IF(In!$Q3="Yes",",
"&In!$Q$2,"")),(IF(In!$R3="Yes",", "&In!$R$2,"")),(IF(In!$AB3="Yes",",
"&In!$AB$2,"")),(IF(In!$AC3="Yes",", "&In!$AC$2,"")),(IF(In!$AD3="Yes",",
"&In!$AD$2,"")),(IF(In!$AI3="Yes",", "&In!$AI$2,"")),(IF(In!$AJ3="Yes",",
"&In!$AJ$2,"")),(IF(In!$AK3="Yes",", "&In!$AK$2,"")),(IF(In!$AL3="Yes",",
"&In!$AL$2,"")),(IF(In!$AM3="Yes",", "&In!$AM$2,"")))

Really appreciate the assistance.

"ECDNewEngland" wrote:

I'm trying to autofill a template worksheet based on selecting a unique name
from a cell with a validation list in the template.

I have created a second worksheet with the list of 25 unique names (the
validation list) in Column A, starting in A2. Cells A1 thru CQ1 contain
unique headers beginning with "Name", "header 2", "header 3", etc out to CQ1.

At each intersecting cell of Name / header I have used validation to select
"Yes" or "No" from a list.

I'm trying to populate seven "fields" in my template worksheet with the
column headers using CONCATENATE when "Yes" exists in various columns for
each "Name".

Due to having 95 columns I have used a rediculously long and inefficient
CONCATENATE formula with IF's in my seven template worksheet fields to check
whether "Yes" is true and if so, concatenate the header.

Suggestions please.