Example:
Col A Col B
Invoice # # Days
12345 11
12345 11
12345 11
98995 15
66438 37
12345 11
98995 15
12345 11
So there are 3 unique invoice numbers. How do I write the formula to find
the average number days it took to receive all three? I'm in Excel 2003.
=AVERAGE(IF(FREQUENCY(A2:A9,A2:A9),B2:B9))
** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.
--
Biff
Microsoft Excel MVP
"Nadine" <Nad...@discussions.microsoft.com> wrote in message
news:3FA76FB1-684F-441F...@microsoft.com...
"T. Valko" wrote:
> .
>
zNadine.xls 14kb
As you'll see the formula (which doesn't have to be array entered) returns
the correct result.
If you're getting an error I suspect that your invoice #s aren't really
numbers like your sample data, or they may look like numbers but they're
really TEXT numbers. TEXT numbers and NUMERIC numbers are not the same.
--
Biff
Microsoft Excel MVP
"Nadine" <Nad...@discussions.microsoft.com> wrote in message
news:EE4B47D4-F555-4C42...@microsoft.com...
"T. Valko" wrote:
> .
>
=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A2:A10)-ROW(A2)+1),B2:B10))
Assumes no empty cells in either range. Empty cells in the Invoice # range
will cause #N/A errors. Empty cells in the amount range could cause an
incorrect result depending on where the empty cells are located.
** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.
--
Biff
Microsoft Excel MVP
"Nadine" <Nad...@discussions.microsoft.com> wrote in message
news:EE667EDF-197D-40AF...@microsoft.com...
Nice one.
"T. Valko" <biffi...@comcast.net> wrote in message
news:OaUXUfx...@TK2MSFTNGP02.phx.gbl...
If they need dynamic ranges I would create those using Insert>Name>Define
rather than building the range in the formula itself: Also, I'd use INDEX
rather than OFFSET if possible.
--
Biff
Microsoft Excel MVP
"Steve Dunn" <st...@sky.com> wrote in message
news:O4Z80ux5...@TK2MSFTNGP06.phx.gbl...
"T. Valko" <biffi...@comcast.net> wrote in message
news:On$Jh6x5K...@TK2MSFTNGP02.phx.gbl...
--
Biff
Microsoft Excel MVP
"Steve Dunn" <st...@sky.com> wrote in message
news:ed99yNy5...@TK2MSFTNGP05.phx.gbl...
$A$2:INDEX($A:$A,COUNTA($A:$A))
instead of:
OFFSET($A$2,,,COUNTA($A:$A)-1)
but the result is a div/0 error.
"T. Valko" <biffi...@comcast.net> wrote in message
news:eqfCkfz5...@TK2MSFTNGP04.phx.gbl...
Invoice = A2:An
Days = B2:Bn
Let's also assume the size of the range will never be greater than 100 rows.
Named ranges...
Invoice
Refers to:
=Sheet1!$A$2:INDEX(Sheet1!$A$2:$A$100,COUNTA(Sheet1!$A$2:$A$100))
Days
Refers to:
=Sheet1!$B$2:INDEX(Sheet1!$B$2:$B$100,COUNTA(Sheet1!$A$2:$A$100))
Then, the array formula:
=AVERAGE(IF(FREQUENCY(MATCH(Invoice,Invoice,0),ROW(Invoice)-MIN(ROW(Invoice))+1),Days))
--
Biff
Microsoft Excel MVP
"Steve Dunn" <st...@sky.com> wrote in message
news:CADBEAB4-1E69-474F...@microsoft.com...
"Steve Dunn" <st...@sky.com> wrote in message
news:CADBEAB4-1E69-474F...@microsoft.com...