View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Zone[_3_] Zone[_3_] is offline
external usenet poster
 
Posts: 373
Default lookup part number in a vertical list and return the most rece

James, this is probably not the most elegant way to do this, but it should
work okay.
Copy this code and paste it into a standard module.
Assumptions:
1. The ship dates are in Sheet2 (change as needed)
2. BuyerPart# is in column A of Sheet2, and ship dates begin in column B
and continue until the end of the month with no spaces between the
BuyerPart# and Aug 31.
3. Row 1 of Sheet2 is a heading row, with a non-empty heading cell for the
BuyerPart# and for each day.

If the part numbers for which you want to get the ship date start in row 2
of column A on the sheet on which you want to get the ship dates, put this
in B2 and drag down as far as needed:
=getship(A2)

Let me know if this works and if you have any questions. Cheers, James

Function GetShip(targ)
Dim RtCol As Integer, shipCol As Integer, shipRow As Long, c As Range
GetShip = ""
With Worksheets("Sheet2")
RtCol = .Cells(1, 1).End(xlToRight).Column
Set c = .Columns(1).Find(targ)
If Not c Is Nothing Then
shipRow = c.Row
shipCol = .Cells(c.Row, "a").End(xlToRight).Column
If Not shipCol RtCol Then GetShip = .Cells(1, shipCol)
End If
End With
End Function


"James T" wrote in message
...
The column headings a general format for Column "A" titled
"Buyer-Part-#"
with date titles in the next columns in the format of
"8/1/2007"....8/31/2007"
There are no blank columns in between the dates.
Thanks.James

"Zone" wrote:

I'll give this a shot. Are the column headings for the shipping date
formatted as text (like Aug 2, Aug 3) or dates (like 2-Aug, 3-Aug) or
what?
Also, is the sheet with the date columns laid out with the part number in
column A, first date in column B, second date in column C, and so on to
Aug
31, with no blanks in-between? James

"James T" <James wrote in message
...
I need to lookup a part number in a "shipment Log" worksheet. It is laid
out
with the following column headers: "Part Number" "Aug 1" "Aug 2" "Aug
3"
etc....
If a part has been shipped, there will be a value under the appropriate
date
column. This value will be the quantity shipped.
I am trying to find the most recent shipment date and return that date
into
a cell in another spreadsheet. Does anyone have any suggestions?