Extracting row with lagest amount

S

Steve Walford

Hope someone can help

Using Excel 2002

I have a large spread sheet, which details the amount of fuel issued
to individual vehicles over a set period (monthly)

The sheet has twelve columns and aprox 4,000 rows, I have only shown
three columns below

Fleet is a unique vehicle reference, in theory that vehicle could fuel
up every day

I need to extract a the complete row for each fleet number that has
the highest amount of fuel against it

ie rows marked *

Fleet Driver Fuel

01486 CLUBLEY J 44.02
01486 CLUBLEY J 48.11
01486 CLUBLEY J 50.02 *
01487 PINDER G 32.02
01487 PINDER G 35.00
01487 PINDER G 40.00
01487 PINDER G 42.79
01487 PINDER G 43.01 *
01488 BREDDY M 23.49
01488 BREDDY M 33.56
01488 BREDDY M 49.76 *
01492 JBUTTERIL 39.13 *
01493 GREEN A 0.00
01493 GREEN A 32.29
01493 GREEN A 36.20
01493 GREEN A 37.00
01493 GREEN A 42.39 *
01495 FIRTH C 29.29
01495 SUTTON M 30.37
01495 FIRTH C 37.33
01495 FIRTH C 38.05
01495 FIRTH C 41.63 *
01496 Pardoe W 28.75
01496 LILLEY M 32.92
01496 SUTTON M 33.00
01496 STONE G 35.99 *

Hope this makes sense

Many thanks in anticipation


Steve
 
G

Glenn

Steve said:
Hope someone can help

Using Excel 2002

I have a large spread sheet, which details the amount of fuel issued
to individual vehicles over a set period (monthly)

The sheet has twelve columns and aprox 4,000 rows, I have only shown
three columns below

Fleet is a unique vehicle reference, in theory that vehicle could fuel
up every day

I need to extract a the complete row for each fleet number that has
the highest amount of fuel against it

ie rows marked *

Fleet Driver Fuel

01486 CLUBLEY J 44.02
01486 CLUBLEY J 48.11
01486 CLUBLEY J 50.02 *
01487 PINDER G 32.02
01487 PINDER G 35.00
01487 PINDER G 40.00
01487 PINDER G 42.79
01487 PINDER G 43.01 *
01488 BREDDY M 23.49
01488 BREDDY M 33.56
01488 BREDDY M 49.76 *
01492 JBUTTERIL 39.13 *
01493 GREEN A 0.00
01493 GREEN A 32.29
01493 GREEN A 36.20
01493 GREEN A 37.00
01493 GREEN A 42.39 *
01495 FIRTH C 29.29
01495 SUTTON M 30.37
01495 FIRTH C 37.33
01495 FIRTH C 38.05
01495 FIRTH C 41.63 *
01496 Pardoe W 28.75
01496 LILLEY M 32.92
01496 SUTTON M 33.00
01496 STONE G 35.99 *

Hope this makes sense

Many thanks in anticipation


Steve


If by "extract", you mean copy to another sheet, then assuming your headers are
in row 1 and data starts in column A, add a column next to "Fleet" (or to the
right of all of your data) and fill down with this:

=IF(A2<>A3,1,0)

Sort by Fleet and then Fuel. Use AutoFilter on your new column to select the
1's. Copy the filtered rows and past in your other sheet.
 
L

Luke M

First, to create a list of unique Fleet numbers.
First cell in column ( say, Z2) do a simple
=A2
Next cell:
=IF(COUNT(MATCH(A$2:A$100,Z$2:Z2,0))<COUNT(1/(A$2:A$100<>""))
INDEX(A$2:A$100,MATCH(0,(A$2:A$100<>"")-ISNA(MATCH(A$2:A$100,Z$1:Z1,0)),0)),"")

and copy down as needed.

Now, to get the data we want. To get Column B, put this in AA2
=OFFSET(B1,SUMPRODUCT(($A$2:$A$100=$Z2)*($C$2:$C$100=MAX(IF($A$2:$A$100=$Z2,$C$2:$C$100,0)))*ROW($A$2:$A$100))-1,0)

Copy this down as needed. To get other columns, change the intial reference
of "B1" to whichever column you want.
 
S

Shane Devenshire

Hi,

You can use the following Array entered formula, assume that you enter a the
first fleet number in F1 and assuming that your data starts on row 3:

=INDEX(C$3:C$28,MATCH(MAX(IF($A3:$A28=$F1,$C3:$C28,"")),$C3:$C28,0))

To make this an array formula it must be entered by pressing
Shift+Ctrl+Enter instead of Enter. Since you want to return the items from
many columns you can drag this formula to the right and it will return data
from column D and so on. You can also enter any fleet numbers you want in F2
and down and then copy the formula down for each of the fleets #'s.
 
A

Ashish Mathur

Hi,

As a first step, please type a heading name for each of the 12 columns. Now
type the heading of column 1 and column 2 in cell N1:O1

Now go to Data > Filter > Advanced Filter and select Copy to another
location. In he list box, give the range reference of the first column.
Leave the criteria box blank and in the Copy to box, select N1:O1. Please
check the box for unique records only and click on OK.

This will give you all the unique Vehicle ref numbers - suppose this range
is N1:O50.

Now in P2, use =max(if(($A$1:$A$4000=N2),$C$1:$C$4000)). Please note that
this is an array formula, so please use Ctrl+Shift+Enter.

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com
 
Top