Hi,
I've got a set of data with three columns (see attachment) - Year, Value1 and Value2. I'm looking to get the upper quartile for all entries for a given year. I'm using an array formula to get the quartile for Value1 and Value 2 separately. So, for Value1:
{=QUARTILE(IF(yr=A1,Value1,""),3)}
This works fine. But I also need to get the same quartiles for the values in Value1 and Value2 together. In other words, the quartile for all values in either the Value1 column or the Value2 column that are in a given year.
I've tried:
{=QUARTILE((IF(yr=A1,Value1,""),IF(yr=A1,Value1,"")),3)}
in a few variations, but it returns a #VALUE error.
There are going to be a whole lot of these tables, unfortunately, and my manager would prefer no columns/rows of extra data added, so I'm wondering if there's any way to do this in a single formula?
Thanks!
Selective Quartile of Multiple Ranges
-
- NewLounger
- Posts: 6
- Joined: 17 Feb 2010, 19:27
Selective Quartile of Multiple Ranges
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78601
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Selective Quartile of Multiple Ranges
Define a named range Value1_2 (or whatever you prefer) that refers to =Sheet1!$E$5:$F$100, i.e. to the Value1 and Value2 columns combined.
You can then use an array formula similar to the one you already have (confirm with Ctrl+Shift+Enter). For L5:
=QUARTILE(IF(yr=I5,Value1_2),3)
Note: for J5 and K5, you can use
=QUARTILE(IF(yr=I5,Value1),3)
and
=QUARTILE(IF(yr=I5,Value2),3)
both as array formulas.
You can then use an array formula similar to the one you already have (confirm with Ctrl+Shift+Enter). For L5:
=QUARTILE(IF(yr=I5,Value1_2),3)
Note: for J5 and K5, you can use
=QUARTILE(IF(yr=I5,Value1),3)
and
=QUARTILE(IF(yr=I5,Value2),3)
both as array formulas.
Best wishes,
Hans
Hans
-
- NewLounger
- Posts: 6
- Joined: 17 Feb 2010, 19:27
Re: Selective Quartile of Multiple Ranges
That's phenomenal - THANK YOU!! This really helps me out. I had no idea you could use arrays of different dimensions in that way.