Selecting the highest value

whlinder

New Member
Joined
Nov 14, 2005
Messages
2
I have two tables that I want to link based on matching criteria, while only picking the highest value in a field.

My fields are TDNR, COUN1, ORAC1, DSTC1, CARR1, MCAR1, CLSC1, FBTD1, FCNO1, PROV2, PROC2, CABIN in Table 1 and ORIG, DEST, CXR, F/C, EFF, DISC, FTNT, RUL, CUR, FARE, TRF, IND, CLASSCD, FTID, and CABCD in Table 2.

I would like to create a new table from these 2, matching ORAC1 to ORIG, DSTC1 to DEST, and CABIN to CABCD. I want to bring back all the fields in Table 1 and the F/C, RUL, CUR, FARE and CLASSCD from Table 2 using Left Join. (I can do everything up to here) This will bring back many records where all the Table 1 records are the same, but the Table 2 records are different. When this happens, I want to pick the record with the highest value in FARE. I've looked at the TOP function but can't seem to get it to work. Is there a way to do this?

Thanks in advance, I just found this site and it looks like there is lots of good info on here.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Not exactly sure what you mean, do you mean changing the 'Group By' to select the Max or Min or something? I've played with some of those but it hasn't yielded the results I am looking for.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top