LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Brad
 
Posts: n/a
Default Return Array with Array

Hi Jackie,

Here is some code I made quickly.

Paste it into a module, then go back to the worksheet. Click on the Insert
menu, then choose Function. Under the Function category choose User Defined.
Then on the right side select SingleCellString.

The Data range refers to the list of info that has the values you want to
return in the string in a single cell. The ConditionalData is the data your
testing against, and TestValue is the value you want to test for in the
ConditionalData.

If you need more variables, let me know and I can add more.

Brad

code
-------------------------------------
Function SingleCellString(Data As Range, ConditionalData As Range, TestValue
As Range) As String
Dim x, y, RowOfData As Integer

x = 0
y = 0
For Each a In Data
x = x + 1
Next

For Each b In ConditionalData
y = y + 1
Next

If x < y Then
SingleCellString = "The 'Data' range of cells does not equal the number
of cells in the 'ConditionalData' range of cells. Please check the ranges and
try again."
Exit Function
End If

RowOfData = 0
For Each c In ConditionalData
RowOfData = RowOfData + 1
If c = TestValue.Value Then
If SingleCellString = "" Then
SingleCellString = Cells(Data.Row + RowOfData - 1,
Data.Column).Value
Else
SingleCellString = SingleCellString & ", " & Cells(Data.Row +
RowOfData - 1, Data.Column).Value
End If
End If
Next

End Function
-----------------------------------



"jackie" wrote:

Brad-

I am trying to do something similar and need my data to appear in one cell
also. If you figure out how to get the output in one cell only, please reply.

Thanks.

"Brad" wrote:

Thanks for taking the time to read my question.

I am just learning how to use Array formulas in Excel. I can Sum, Count
etc. I am wondering if you can return an array of data with an array formula

Example:

Name Replied?

Bob N
Brian Y
Robyn N
Rachel Y

From the table above if I test for "N" I'd like the formula to return a list
of names, in this case Bob and Robyn.

Thanks again for your help,

Brad

 
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
Return a cell value based on specific combinations of cells in an array rmcnam05 Excel Worksheet Functions 2 October 11th 05 03:28 AM
Return a column # from an array mjack003 Excel Discussion (Misc queries) 9 September 17th 05 07:54 PM
return array result in cell based on comparing dates Ruthki Excel Worksheet Functions 7 June 30th 05 11:41 PM
How to use an array or matrix to return text vs. numeric values Ingrid Excel Worksheet Functions 2 April 10th 05 12:51 AM
How do I return an entire row of data from a reference array? tvmodica Excel Worksheet Functions 2 January 7th 05 08:52 PM


All times are GMT +1. The time now is 01:55 PM.

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"