Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default how do i write a function to display a list of information

i tried asking this in an earlier post. i'd like to write a function that
will look for a certain digit in one column of a worksheet, and bring
information from corresponding rows in a different column. i don't want to
count the number of occurrences, but display a list of them all. is this
possible?
--
steph
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,089
Default how do i write a function to display a list of information

Steph

It might look something like:

Function fFindValues(ByRef FindValue As Range, _
ByRef LookInValues As Range, _
ByVal ColumnOffset As Integer)
' example call: =fFindValues(A1,B:B,1)
' looks for the value in cell A1 in column B
' example call: =fFindValues(A1,B1:B20,1)
' looks for the value in cell A1 in cells B1:B20
' uses ColumOffset to determine where to get the returned value(s)

Application.Volatile
Application.ScreenUpdating = False
Dim cell As Range
Dim FindValues
FindValues = ""
For Each cell In LookInValues
If cell.Value = FindValue Then
If FindValues = "" Then
FindValues = cell.Offset(0, ColumnOffset).Value
Else
FindValues = FindValues & ", " & _
cell.Offset(0, ColumnOffset).Value
End If
End If
Next
fFindValues = FindValues
Application.ScreenUpdating = True
End Function

It's not tested to death but it works in the simple case. Possibly/probably
not the quickest way to do it. Might prompt improvements and alternatives
though.

Note: it's much quicker if you limit the selection to cells rather than the
column. You could, of course, work out how many cells are in use in the
column and restrict it yourself.

Regards

Trevor


"steph" wrote in message
...
i tried asking this in an earlier post. i'd like to write a function that
will look for a certain digit in one column of a worksheet, and bring
information from corresponding rows in a different column. i don't want to
count the number of occurrences, but display a list of them all. is this
possible?
--
steph



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default how do i write a function to display a list of information

Hi!

Search column A for 10, return the corresponding values from column B.

Entered as an array using the key combination of CTRL,SHIFT,ENTER (not just
ENTER):

=IF(ROWS($1:1)<=COUNTIF(A$2:A$20,10),INDEX(B$2:B$2 0,SMALL(IF(A$2:A$20=10,ROW(INDIRECT("1:"&ROWS(A$2: A$20)))),ROWS($1:1))),"")

Copy down until you get blanks.

Biff

"steph" wrote in message
...
i tried asking this in an earlier post. i'd like to write a function that
will look for a certain digit in one column of a worksheet, and bring
information from corresponding rows in a different column. i don't want to
count the number of occurrences, but display a list of them all. is this
possible?
--
steph



Reply
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
Function to not display until data entered tml41dmb Excel Discussion (Misc queries) 2 February 23rd 06 05:47 PM
Function To Dynamically Display File Size MDW Excel Worksheet Functions 1 February 16th 06 09:45 PM
Find in list function jrup New Users to Excel 2 August 23rd 05 12:16 AM
Excel option to store trendline's coefficients in cells for use Miguel Saldana Charts and Charting in Excel 9 June 20th 05 08:45 PM
how to use the Prob function in a list of averages to find the le josephWard6 Excel Worksheet Functions 2 June 19th 05 11:14 PM


All times are GMT +1. The time now is 11:03 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"