help with formula working in one cell and not when copied

sleepers

Board Regular
Joined
May 26, 2004
Messages
203
one last question

i have got it working for the Jul colum - thanks to you guys :biggrin:

Output is etc::
,3,4,5, , ,8, , , ,12, , , , , ,18, , , ,22, ,24, , ,27,28, ,30,

but when i copied and pasted into next cell to make a Aug column and changed the formula to read
=concatmth(D5:DU5,"Aug",TRUE)

it came back as a #value error

what am i doing please



__________________________
Function ConcatMth(rng As Range, item As String, Optional dte = False)
Application.Volatile
For Each ce In rng
If ce <> "" And Sheets(rng.Parent.Name).Cells(2, ce.Column) = item Then
If dte Then
holder = holder & Format(ce, "d") & ","
Else
holder = holder & ce & ""
End If
End If
Next ce
ConcatMth = Left(holder, Len(holder) - 1)
End Function

Function ConcatDay(rng As Range, item As String, Optional dte = False)
Application.Volatile
For Each ce In rng
If ce <> "" And Sheets(rng.Parent.Name).Cells(3, ce.Column) = item Then
If dte Then
holder = holder & Format(ce, "dd/mm") & ","
Else
holder = holder & ce & ","
End If
End If
Next ce
ConcatDay = Left(holder, Len(holder) - 1)
End Function
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Also i am getting a comma when there is no number so it displays

2,3, , ,6, ,8, ,10, , , ,14, , , ,18, ,20, , , ,24, ,26, , ,29,30,

any way to make it not show a comma if there is no number??

thanks again
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,845
Members
449,051
Latest member
excelquestion515

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