Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Check columns for data match...

Using XL 2000

I have a worksheet which contains 10 columns A:J and over 500 lines.
The data in each cell in the Column range E:J contains either a TRUE or FALSE.

Row 1 contains header labels for each column.

Im looking for a routine to loop through each column, per line and where a
TRUE exists in that column, and ( where more than one TRUE is found)
concatenate the label name in to column K of the same row being checked.

Hope this makes sense.
Ideas appreciated. Thanks, Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Check columns for data match...

You can do this as a worksheet formula instead of code; below is the formula
for K2, which could then be copied down for each row in your list:

=IF(E2,E$1,"")&IF(F2,F$1,"")&IF(G2,G$1,"")&IF(H2,H $1,"")&IF(I2,I$1,"")&IF(J2,J$1,"")

If you want spaces between the label names:
=TRIM(IF(E2,E$1&" ","")&IF(F2,F$1&" ","")&IF(G2,G$1&" ","")&IF(H2,H$1&"
","")&IF(I2,I$1&" ","")&IF(J2,J$1&" ",""))

"Paulc" wrote:

Using XL 2000

I have a worksheet which contains 10 columns A:J and over 500 lines.
The data in each cell in the Column range E:J contains either a TRUE or FALSE.

Row 1 contains header labels for each column.

Im looking for a routine to loop through each column, per line and where a
TRUE exists in that column, and ( where more than one TRUE is found)
concatenate the label name in to column K of the same row being checked.

Hope this makes sense.
Ideas appreciated. Thanks, Paul

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Check columns for data match...

How about a formula:

=IF(E2,$E$1,"")&IF(F2,$F$1,"")&IF(G2,$G$1,"")&IF(H 2,$H$1,"")
&IF(I2,$I$1,"")&IF(J2,$J$1,"")
(all one cell)

or if you want spaces between values:
=TRIM(IF(E2,$E$1,"")&" "&IF(F2,$F$1,"")&" "&IF(G2,$G$1,"")&" "&IF(H2,$H$1,"")
&" "&IF(I2,$I$1,"")&" "&IF(J2,$J$1,""))
(still all one cell)


Paulc wrote:

Using XL 2000

I have a worksheet which contains 10 columns A:J and over 500 lines.
The data in each cell in the Column range E:J contains either a TRUE or FALSE.

Row 1 contains header labels for each column.

Im looking for a routine to loop through each column, per line and where a
TRUE exists in that column, and ( where more than one TRUE is found)
concatenate the label name in to column K of the same row being checked.

Hope this makes sense.
Ideas appreciated. Thanks, Paul


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Check columns for data match...

Thanks for your ideas.
looking at my options again, I need to resolve this programatically.
I think my answer is based around a column loop through routine.
Just not sure of the code.
Paul



"Dave Peterson" wrote:

How about a formula:

=IF(E2,$E$1,"")&IF(F2,$F$1,"")&IF(G2,$G$1,"")&IF(H 2,$H$1,"")
&IF(I2,$I$1,"")&IF(J2,$J$1,"")
(all one cell)

or if you want spaces between values:
=TRIM(IF(E2,$E$1,"")&" "&IF(F2,$F$1,"")&" "&IF(G2,$G$1,"")&" "&IF(H2,$H$1,"")
&" "&IF(I2,$I$1,"")&" "&IF(J2,$J$1,""))
(still all one cell)


Paulc wrote:

Using XL 2000

I have a worksheet which contains 10 columns A:J and over 500 lines.
The data in each cell in the Column range E:J contains either a TRUE or FALSE.

Row 1 contains header labels for each column.

I€„¢m looking for a routine to loop through each column, per line and where a
TRUE exists in that column, and ( where more than one TRUE is found)
concatenate the label name in to column K of the same row being checked.

Hope this makes sense.
Ideas appreciated. Thanks, Paul


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Check columns for data match...

If it needs to be done programatically, then you could do it like this:
Dim ListLength as Integer, RowCounter as Integer, CellVal as String
ListLength = Range("A1").CurrentRegion.Rows.Count
For RowCounter = 2 to ListLength
With Range("K" & RowCounter)
.Formula = "=IF(E2,$E$1,"""") & IF(F2,$F$1,"""") & IF(G2,$G$1,"""") &
IF(H2,$H$1,"""") & IF(I2,$I$1,"""") & IF(J2,$J$1,"""")"
CellVal = .Value
.Value = CellVal
End With
Next RowCounter

"Paulc" wrote:

Thanks for your ideas.
looking at my options again, I need to resolve this programatically.
I think my answer is based around a column loop through routine.
Just not sure of the code.
Paul



"Dave Peterson" wrote:

How about a formula:

=IF(E2,$E$1,"")&IF(F2,$F$1,"")&IF(G2,$G$1,"")&IF(H 2,$H$1,"")
&IF(I2,$I$1,"")&IF(J2,$J$1,"")
(all one cell)

or if you want spaces between values:
=TRIM(IF(E2,$E$1,"")&" "&IF(F2,$F$1,"")&" "&IF(G2,$G$1,"")&" "&IF(H2,$H$1,"")
&" "&IF(I2,$I$1,"")&" "&IF(J2,$J$1,""))
(still all one cell)


Paulc wrote:

Using XL 2000

I have a worksheet which contains 10 columns A:J and over 500 lines.
The data in each cell in the Column range E:J contains either a TRUE or FALSE.

Row 1 contains header labels for each column.

I€„¢m looking for a routine to loop through each column, per line and where a
TRUE exists in that column, and ( where more than one TRUE is found)
concatenate the label name in to column K of the same row being checked.

Hope this makes sense.
Ideas appreciated. Thanks, Paul


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question regarding VLookup and if it can check two columns of data Smoke Excel Worksheet Functions 2 September 23rd 08 09:10 PM
Match Data for 4 Columns Steve C Excel Discussion (Misc queries) 3 November 30th 07 11:35 AM
Match data in 2 columns and return data from 3rd column gwtreece[_2_] Excel Worksheet Functions 1 April 4th 07 03:27 PM
match columns and associated data RayB Excel Discussion (Misc queries) 2 July 18th 06 07:34 PM
MATCH UP DATA IN COLUMNS jickes Excel Worksheet Functions 2 March 2nd 06 01:14 AM


All times are GMT +1. The time now is 09:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"