VLOOKUP which gives highest value

cpisthedbb

New Member
Joined
Apr 10, 2018
Messages
30
Hi,

The spreadsheet I am using has 3 orders which make one bulk order. The 3 orders have 3 different finish dates. Is there a way of putting on a vlookup formula which then chooses the highest date (this is to create a pivot table).

For example:

Order Finish date Bulk order
1 01/01/18 500
2 05/01/18 500
3 06/01/18 500

So in this example I need to look up the last finish date for Bulk order 500 which is 06/01/18 and ignore the 01/01 & 05/01.

Hope this makes sense.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
If you have the MAXIFS function (Office 365) you can use F2
If you have Excel 2010 or later you can use G2
H2 for all versions but this is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Excel Workbook
ABCDEFGH
1Order Finish dateBulk orderBulk orderLast date
221/01/20184005006/01/20186/01/20186/01/2018
32/01/201840040021/01/201821/01/201821/01/2018
41/01/2018500
55/01/2018500
66/01/2018500
Highest date
 
Upvote 0
If you have the MAXIFS function (Office 365) you can use F2
If you have Excel 2010 or later you can use G2
H2 for all versions but this is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Highest date

ABCDEFGH
1Order Finish dateBulk order Bulk orderLast date
221/01/2018400 5006/01/20186/01/20186/01/2018
32/01/2018400 40021/01/201821/01/201821/01/2018
41/01/2018500
55/01/2018500
66/01/2018500

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:121px;"><col style="width:78px;"><col style="width:25px;"><col style="width:21px;"><col style="width:74px;"><col style="width:103px;"><col style="width:97px;"><col style="width:97px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
F2=MAXIFS(A$2:A$6,B$2:B$6,E2)
G2=AGGREGATE(14,6,A$2:A$6/(B$2:B$6=E2),1)
H2{=MAX(IF(B$2:B$6=E2,A$2:A$6))}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


Thanks for the quick reply. I'm using 2010 Excel- for some reason G2 formula isn't giving me the dates and H2 I'm getting the #NUM ! error. I must be doing something wrong but I'm not sure what...
 
Upvote 0
G2 formula isn't giving me the dates ..
What is G2 giving you?


Do you have any existing errors (eg #NUM !) in columns A:B?

If you try the G2 & H2 formulas in a new sheet with the sample data I used manually entered, do they work for you?

BTW, best not to fully quote long posts as it makes the thread harder to read/navigate. If you want to quote, quote small, relevant parts only.
 
Last edited:
Upvote 0
What is G2 giving you?


Do you have any existing errors (eg #NUM !) in columns A:B?

If you try the G2 & H2 formulas in a new sheet with the sample data I used manually entered, do they work for you?
.

What is G2 giving you?


Do you have any existing errors (eg #NUM !) in columns A:B?

If you try the G2 & H2 formulas in a new sheet with the sample data I used manually entered, do they work for you?

Thanks for the reply. G2 gives the date 00/01/00. The columns a:b do have some n/a values in as it works off a VLOOKUP. Is this likely the issue?

The formula did work when I copied and pasted your table so is my spreadsheet.
 
Upvote 0
G2 gives the date 00/01/00.
That would seem to indicate that the only rows for that Bulk order number have zero or blank cells in column A. Example below. Is that the case?

Excel Workbook
ABCDEG
1Order Finish dateBulk orderBulk orderLast date
221/01/20184005000/01/1900
3N/A40040021/01/2018
4500
5N/A500
6500
Highest date




The columns a:b do have some n/a values in as it works off a VLOOKUP. Is this likely the issue?
Yes it is, I suggest that you change those column A VLOOKUP formulas as follows & see how that goes.

=IFERROR(your_existing_vlookup,"N/A")
 
Upvote 0
Hi Peter,

Late reply but I've only just got around to re-looking at this. I managed to get this to work so thanks for your help, once again you've come up trumps!
 
Upvote 0
You’re welcome. Glad you were able to resolve the final issues.
 
Upvote 0

Forum statistics

Threads
1,217,350
Messages
6,136,054
Members
449,986
Latest member
Mark39841

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