what am i doing wrong please with adding a function

sleepers

Board Regular
Joined
May 26, 2004
Messages
203
Hi have i done this right as i get a #Name? error

i have put the follows code in the macro sheets and then in the cell at the end of the row for angel gear (as displayed above in image) i have put:

=concatmth(B4:T4,"Jul")
_______________________________________________________________________

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

Function ConcatDay(rng As Range, item As String)
Application.Volatile
For Each ce In rng
If ce <> "" And Sheets(rng.Parent.Name).Cells(2, ce.Column) = item Then
holder = holder & ce & ","
End If
Next ce
ConcatDay = Left(holder, Len(holder) - 1)
End Function
______________________________________________________________________

what have i dont wrong please ??

Image00048.jpg
 
one last question

i have got it workin for the Jul colum

Output is
,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")
it came back as a #value error

what am i doing please
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,215,746
Messages
6,126,638
Members
449,325
Latest member
Hardey6ix

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