excel array formula to calculate min of two variable columns

Posted on 2014-04-21
Last Modified: 2014-04-21
I have the following data file where column B shows the data, column C shows the max of the data since inception and column D shows the percentage difference between columns C and D.  In cell E1, the minimum of column D is calculated. All straightforward stuff.

I would like to have an array formula that calculates the minimum difference over a set number of days (i.e. last 100 or 200 rows) and does away with columns C and D. So the formula would include lastrow (offset) - the number of rows.(variable).

I have included an example with spreadsheets.

Question by:CC10
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 40012653

for the last 200

Author Comment

ID: 40012750
I get a Value# sign when I enter the formula

Also this does not solve my problem. The formula should work so that for any number of rows chosen, column C will be adjusted.
Column C calculates the maximum value of column B for the number of rows chosen.

Assume rows C and D do not exist. Then, if the number of rows chosen is 100, the formula must calculate MIN(max(last100 rows of columnB)/((last100rowsof columnsB)). I think this is some sort of array formula as each row as has to be calculated.

Does that make sense?
LVL 43

Accepted Solution

Saqib Husain, Syed earned 400 total points
ID: 40012790
I get a Value# sign when I enter the formula
Enter it as an array formula

The formula should work so that for any number of rows chosen, column C will be adjusted
Change all 200's to a cell address and enter 200 or whatever in that cell.
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

LVL 23

Expert Comment

ID: 40012797
Try this array formula:


for 200 last records.

Author Closing Comment

ID: 40012847
Thanks, thats fine.
LVL 23

Expert Comment

ID: 40012919
Are you certain the solution you accepted gives you the expected results?

I tried it and whether you use 200 or replace the 200 with 100 you get the same result of -7.97%!

The formula I gave gives the results you show on ExampleLast200 given the full dataset of ExampleAll.

And if you replace all the 200's with 100's you get the result you show in ExampleLast100.
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 40012946
You are probably right. That formula works only on the 200 sheet. Not on the first sheet.
LVL 23

Expert Comment

ID: 40013287

In case you decide that my formula was the what you were actually looking for; then in order to use a cell reference to contain the 200 or whatever number of rows you want to test for, try:


where N1 contains the number of last rows to test for (e.g. 200)

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question