Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return a cell value based on specific combinations of cells in an array | Excel Worksheet Functions | |||
Return a column # from an array | Excel Discussion (Misc queries) | |||
return array result in cell based on comparing dates | Excel Worksheet Functions | |||
How to use an array or matrix to return text vs. numeric values | Excel Worksheet Functions | |||
How do I return an entire row of data from a reference array? | Excel Worksheet Functions |