Home » excel » excel – Finding Max/Min Without Using Array

excel – Finding Max/Min Without Using Array

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a Summary tab in an Excel file that needs to look at an Accruals tab to find a Max and Min. The problem I am having is that there are many different Location/Commodity combinations and I need to find the Max and Min based on the Location/Commodity combination. Location and Commodity are in two separate columns.

For example, location 123 can have a commodity of 01, 02, and 03. Location 123 Commodity 01 can have several different prices. I need to look up location 123, commodity 01 and find the max of those prices.

I have been asked not to use an array as it slows the files down. I was previously attempting to use =MAX(IF()) but that was not preferred.

How can I find values on the Accruals tab based on the location column AND the commodity column matching from the Summary tab and then get the max of those values based on the loc/comm combination? Is there a more simple way through VBA? I was trying to write a loop but I am not very advanced and having some difficulty.

How to&Answers:

I hadn’t really thought about a pivot table. My prior experience with those haven’t been great, but this seems to be able to give me exactly what I need.

I created two pivot tables – one for max, one for min and then used the GETPIVOTDATA() function on the Summary tab to pull in those values based on location and commodity combination.

Thank you all for your help!