Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Concatenate with date range

Hi,

I have 3 columns and multiple rows.
Column A contains the product name
Column B contains the start date
Column C contains the completion date

I would like to concatenate all the product names within a specified date
range into 1 cell. I already have my date range identified in another tab
(i.e. FY!E3:E4)
Any ideas how I can do this?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Concatenate with date range

You can use a UDF function like below


call with
=CatNames(A1:A100, FY!E3:E4)



Function CatNames(Target As Range, Dates As Range)
StartDate = Dates(1)
EndDate = Dates(2)

CatNames = ""
For RowOffset = 1 To Target.Rows.Count
If (Target(RowOffset, 2) = StartDate And _
Target(RowOffset, 2) <= EndDate) Or _
(Target(RowOffset, 3) = StartDate And _
Target(RowOffset, 3) = EndDate) Then

CatNames = CatNames & "," & Target(RowOffset, 1)
End If
Next RowOffset

End Function



"Pete@cadth" wrote:

Hi,

I have 3 columns and multiple rows.
Column A contains the product name
Column B contains the start date
Column C contains the completion date

I would like to concatenate all the product names within a specified date
range into 1 cell. I already have my date range identified in another tab
(i.e. FY!E3:E4)
Any ideas how I can do this?

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 793
Default Concatenate with date range

Best way is to write a Macro which will loop through the range and concatenate.

Concatenate has a limit of 255 cells. One way is to write a formula like the
following, copy it into the number of entries in your range, and concatenate
the formula into the result cell -
=IF(AND(IF(B1FY!$E$3,1,0),IF(C1<FY!$E$4,1,0)),A1, "")


"Pete@cadth" wrote:

Hi,

I have 3 columns and multiple rows.
Column A contains the product name
Column B contains the start date
Column C contains the completion date

I would like to concatenate all the product names within a specified date
range into 1 cell. I already have my date range identified in another tab
(i.e. FY!E3:E4)
Any ideas how I can do this?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Concatenate with date range

When you have a range of dates usally you want to have if any of the dates in
the range are within a start date and an end date. Your case only considers
if the range of dates are completely withiin the start and end dates.

"Sheeloo" wrote:

Best way is to write a Macro which will loop through the range and concatenate.

Concatenate has a limit of 255 cells. One way is to write a formula like the
following, copy it into the number of entries in your range, and concatenate
the formula into the result cell -
=IF(AND(IF(B1FY!$E$3,1,0),IF(C1<FY!$E$4,1,0)),A1, "")


"Pete@cadth" wrote:

Hi,

I have 3 columns and multiple rows.
Column A contains the product name
Column B contains the start date
Column C contains the completion date

I would like to concatenate all the product names within a specified date
range into 1 cell. I already have my date range identified in another tab
(i.e. FY!E3:E4)
Any ideas how I can do this?

Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 793
Default Concatenate with date range

If you want any date then you may replace AND with OR.

"Joel" wrote:

When you have a range of dates usally you want to have if any of the dates in
the range are within a start date and an end date. Your case only considers
if the range of dates are completely withiin the start and end dates.

"Sheeloo" wrote:

Best way is to write a Macro which will loop through the range and concatenate.

Concatenate has a limit of 255 cells. One way is to write a formula like the
following, copy it into the number of entries in your range, and concatenate
the formula into the result cell -
=IF(AND(IF(B1FY!$E$3,1,0),IF(C1<FY!$E$4,1,0)),A1, "")


"Pete@cadth" wrote:

Hi,

I have 3 columns and multiple rows.
Column A contains the product name
Column B contains the start date
Column C contains the completion date

I would like to concatenate all the product names within a specified date
range into 1 cell. I already have my date range identified in another tab
(i.e. FY!E3:E4)
Any ideas how I can do this?

Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Concatenate with date range

OR will not work!!!

if your range is between 8/1/08 and 8/31/08 9/1 will pass the OR test.

"Sheeloo" wrote:

If you want any date then you may replace AND with OR.

"Joel" wrote:

When you have a range of dates usally you want to have if any of the dates in
the range are within a start date and an end date. Your case only considers
if the range of dates are completely withiin the start and end dates.

"Sheeloo" wrote:

Best way is to write a Macro which will loop through the range and concatenate.

Concatenate has a limit of 255 cells. One way is to write a formula like the
following, copy it into the number of entries in your range, and concatenate
the formula into the result cell -
=IF(AND(IF(B1FY!$E$3,1,0),IF(C1<FY!$E$4,1,0)),A1, "")


"Pete@cadth" wrote:

Hi,

I have 3 columns and multiple rows.
Column A contains the product name
Column B contains the start date
Column C contains the completion date

I would like to concatenate all the product names within a specified date
range into 1 cell. I already have my date range identified in another tab
(i.e. FY!E3:E4)
Any ideas how I can do this?

Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 193
Default Concatenate with date range

Thanks Joel. I'm a beginner with VBA. Would it be possible to add comments
to your function so that I can better understand the logic?

I assume that I need to replace Dates(1) and Dates(2) with actual dates?

"Joel" wrote:

You can use a UDF function like below


call with
=CatNames(A1:A100, FY!E3:E4)



Function CatNames(Target As Range, Dates As Range)
StartDate = Dates(1)
EndDate = Dates(2)

CatNames = ""
For RowOffset = 1 To Target.Rows.Count
If (Target(RowOffset, 2) = StartDate And _
Target(RowOffset, 2) <= EndDate) Or _
(Target(RowOffset, 3) = StartDate And _
Target(RowOffset, 3) = EndDate) Then

CatNames = CatNames & "," & Target(RowOffset, 1)
End If
Next RowOffset

End Function



"Pete@cadth" wrote:

Hi,

I have 3 columns and multiple rows.
Column A contains the product name
Column B contains the start date
Column C contains the completion date

I would like to concatenate all the product names within a specified date
range into 1 cell. I already have my date range identified in another tab
(i.e. FY!E3:E4)
Any ideas how I can do this?

Thanks.

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Concatenate with date range

Function CatNames(Target As Range, Dates As Range)
'Start Date is 1st parameter in Dates
StartDate = Dates(1)
'End Date is 2nd parameter in Dates
EndDate = Dates(2)

CatNames = ""
'Check each Row in Target range for dates
' between start and end dates
For RowOffset = 1 To Target.Rows.Count
'check if start date in Row is greater then
'selected start date and less than selected end date
'or
'end date in row is greater than start date
'and less the selected end date
If (Target(RowOffset, 2) = StartDate And _
Target(RowOffset, 2) <= EndDate) Or _
(Target(RowOffset, 3) = StartDate And _
Target(RowOffset, 3) = EndDate) Then

'if the dates are in range then Catenate the
'data in column A
CatNames = CatNames & "," & Target(RowOffset, 1)
End If
Next RowOffset

End Function


"Pete" wrote:

Thanks Joel. I'm a beginner with VBA. Would it be possible to add comments
to your function so that I can better understand the logic?

I assume that I need to replace Dates(1) and Dates(2) with actual dates?

"Joel" wrote:

You can use a UDF function like below


call with
=CatNames(A1:A100, FY!E3:E4)



Function CatNames(Target As Range, Dates As Range)
StartDate = Dates(1)
EndDate = Dates(2)

CatNames = ""
For RowOffset = 1 To Target.Rows.Count
If (Target(RowOffset, 2) = StartDate And _
Target(RowOffset, 2) <= EndDate) Or _
(Target(RowOffset, 3) = StartDate And _
Target(RowOffset, 3) = EndDate) Then

CatNames = CatNames & "," & Target(RowOffset, 1)
End If
Next RowOffset

End Function



"Pete@cadth" wrote:

Hi,

I have 3 columns and multiple rows.
Column A contains the product name
Column B contains the start date
Column C contains the completion date

I would like to concatenate all the product names within a specified date
range into 1 cell. I already have my date range identified in another tab
(i.e. FY!E3:E4)
Any ideas how I can do this?

Thanks.

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
concatenate cells by a given range Twan Kennis Excel Worksheet Functions 4 July 1st 06 12:54 AM
function to concatenate range GoBobbyGo Excel Discussion (Misc queries) 2 April 19th 06 01:34 AM
concatenate a range function Wildaz Excel Worksheet Functions 7 March 15th 06 07:10 PM
I know how to concatenate ,can one de-concatenate to split date? QUICK BOOKS PROBLEM- New Users to Excel 1 July 26th 05 05:07 PM
Concatenate a range King Excel Worksheet Functions 3 March 11th 05 09:10 PM


All times are GMT +1. The time now is 08:32 AM.

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"