View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Lookup Data on a Worksheet

Since you are getting the data from another sheet, you need to modify the
function like this:

Function GetDateTotal(Mydate As Date, Target)

Set FindRange = Target.Find(Mydate)

myrow = FindRange.Row + 8
mycol = FindRange.Column

GetDateTotal = FindRange.Parent.Cells(myrow, mycol).Value


End Function

otherwise you return information from the sheet with the formula which would
be meaninless in the context it has been presented.

Also, Find won't work in A User Defined function in xl2000 and earlier.
(just some information for the OP).

--
Regards,
Tom Ogilvy


"Joel" wrote in message
...
John: The functio below will search any range of date, find a date, and
then
return the value that is 8 rows below the date. To call the function from
a
worksheet

=GetDatetotal(a1,sheet2!A1:a100)

where a1 contains a cell in date format

Function GetDateTotal(Mydate As Date, Target)

Set FindRange = Target.Find(Mydate)

myrow = FindRange.Row + 8
mycol = FindRange.Column

GetDateTotal = Cells(myrow, mycol).Value


End Function

"JKHouston" wrote:

Hello everyone,

I'm asking for help to solve this problem as I'm pretty sure that I'd
need
to programmatically get this data rather than do it with functions. I
might
be able to figure something out with functions but it would probably be a
lot
neater otherwise.

What I have is a main page with peoples names in vertical columns with
dates
across the top to use to match the data with. I also have worksheets with
those peoples names on them that store the data in more detail. What I'd
like
to do is get the value of one cell (the sum total) of the detail numbers.
The
sum is always in the same place, 8 rows down from a given date.

One of the biggest problems is that my detail worksheet does not have
contiguous ranges. They go from; F2:L9 , C12:L19 , C22:L29 and finally
C32:K39. Those ranges encompass both the date and the sum figure I want,
which is row 8 in this range.

Would it be possible to figure out a way on the main summary page to look
at
the persons name, find the worksheet based on that persons name, match
the
dates and record the sum from the detail page onto the summary page?

I sure as heck can't do it! :) Any help would sure be appreciated.

Thanks
John