Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting specific information from table

Status
Not open for further replies.

FrankMars

Technical User
Dec 20, 2010
67
US
I have a table called "Item Price History". On the first day of each month I enter the price of various items for that month. My table contents will look something like this: Item A for Jan = 5.00, Item A for Feb = 5.35, Item A for March = 5.75. Item B for Jan = 8.00, Item B for Feb = 8.10, Item B for March = 8.40. Item C for Jan = 2.00, Item C for Feb = 2.30, Item C for March = 2.60, and so on for about 75 items.

I would like to use code to create a datasheet which includes only the records with the highest price for each item. I'm an amateur with vba. Thanks in advance.
 
Is that how your data looks like?

[pre]
MyItem MyDate MyPrice
A 1/1/2012 5.00
A 2/1/2012 5.35
A 3/1/2012 5.75
B 1/1/2012 8.00
B 2/1/2012 8.10
B 3/1/2012 8.40
C 1/1/2012 2.00
C 2/1/2012 2.30
C 3/1/2012 2.60
[/pre]

Or am I way off...

Have fun.

---- Andy
 
hi,

Why VBA? Why not a simple query like
Code:
select item, max(price)
from [your table]
group by item

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks guys, heading in the 'simple query' direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top