1

Im currently facing a problem trying to find variations in a Database as follows:

>   Date   | Hour | Place 1 | Place 2 | Place 3 ... Place K (about 50)
>-------------------------------------------------------------
>1-1-2013  |  1   |  654    |  842    |  326    ...   842
>1-1-2013  |  2   |  847    |  247    |  625    ...   874
>1-1-2013  |  3   |  648    |  321    |  547    ...   624
>   ...    | ...  |  ...    |  ...    |  ...    ...   ...
>1-1-2013  |  24  |  748    |  654    |  548    ...   743
>2-1-2013  |  1   |  648    |  548    |  624    ...   845
>2-1-2013  |  2   |  654    |  348    |  247    ...   254
>   ...    |  ... |  ...    |   ...   |  ...    ...   ...

Dates as Day/Month/Year

What I need is a way to find the difference between the max and min value for each day for each place.

Either in one formula or using an aux sheet.

Im guessing some sort of Max(If and Min(If but I haven't been able to figure it out.

After getting those differences I need to know which are the top 5 biggest ones per day. (I know how to get the top 1, but I have no idea how to get the other 4).

Any help would be appreciated.

  • "which are the top 5 biggest ones per day" - how do you want to manage duplicates (e.g. 842 is twice in 1st hour for 1st day)? Do you want to list them twice (third and fourth biggest values are both 842), or only once? How often do you need to run this task? Do you append data below your range or it's always a new sheet? – Máté Juhász Aug 18 '15 at 12:35
  • Sorry, I didn't make myself clear, I meant the biggest differences. And duplicates should be listed twice. I'll need to run this on around 3 years of data ( so 3*365*24=26.280 rows ). All the data will be in the same sheet, the outcome can be on another. – Vicente Gre Aug 18 '15 at 19:26
1
=MAX(IF($A$2:$A$26281=$A2,C$2:C$26281,""))-MIN(IF($A$2:$A$26281=$A2,C$2:C$26281,""))

Will find the difference between the smallest and largest value for a given place on a given day. Enter as an array formula by confirming with ctrl+shift+enter. Assuming your data starts at A1 and doesn't have any blank rows or columns, you can enter this formula for Place 1, autofill over to Place k, then autofill down. It will probably take forever to calculate.

You can use LARGE() to find the top five biggest values from that.

  • What should I put between "" ? And where should I place this formula? Im trying to use it by placing it a few columns after K and writing the place name between "" but Im getting a wrong number. – Vicente Gre Aug 20 '15 at 20:52
  • 1
    @VicenteGre The formula is designed such that you put it in row two after place k. If you autofill it down it will tell you all the differences for Place 1, so you can autofill across to also get the data for places 2-k. Do not put anything between the quotes, it's that way on purpose. – Kyle Aug 20 '15 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.