LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default aconcat UDF throwing a #NAME error

I'm attempting to display in a cell a concatenated list of items that
match in an array. Here is an example:

Data:
A B
1 Bob Chicken
2 Sally Steak
3 Bob Salad
4 Susan Salad
5 Bob Soda


And for the lookup:

A B
1 Bob Chicken Salad Soda
2 Sally Steak
3 Susan Salad

Column B of the lookup is the portion I'm focusing on here.
Originally, i was able to successfully do this using MCONCAT from the
morefunc addon. This worked great, except I am sending this
spreadsheet to others that do not have this addon installed, and it
isn't reasonable to ask them to install it, so I attempted to change
it to the aconcat UDF from Harlan Grove:

Function ACONCAT(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant

If TypeOf a Is Range Then
For Each y In a.Cells
ACONCAT = ACONCAT & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
ACONCAT = ACONCAT & y & sep
Next y
Else
ACONCAT = ACONCAT & a & sep
End If

ACONCAT = Left(ACONCAT, Len(ACONCAT) - Len(sep))
End Function



This results in a #NAME error. I can't seem to figure out why. I've
grabbed screenshots of the error:

Before Eval: http://imagebin.ca/view/L0mxlr8.html
Step 1 of Eval: http://imagebin.ca/view/ev1f3A1.html

I placed this in 'Module1' at first, then tried placing it in a sheet
module. I'm not sure what else to check. This is my first attempt at
a UDF, so I appreciate any insight. I'm using Excel 2007 (as are many
of the folks that will be viewing the document), but am saving in
Excel 2003 for compatibility.
 
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
Counting instances of found text (Excel error? Or user error?) S Davis Excel Worksheet Functions 5 September 12th 06 04:52 PM
I have Error 1919 Error Configuring ODBC dataSource Database Texanna1 Excel Discussion (Misc queries) 1 September 12th 06 06:35 AM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Throwing Out top & lower percentages Gary Gonzales Excel Worksheet Functions 2 February 23rd 06 08:30 PM


All times are GMT +1. The time now is 02:59 AM.

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

About Us

"It's about Microsoft Excel"