#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 216
Default Average If...

I have a column of invoice numbers and multiple rows of data pertaining to
each one. So one invoice number could have 10 rows of data pertaining to it
so the invoice number will be repeated 10 times. Then on each line is the
time it took to receive the data so this number will be the same on all 10
lines. I have hundreds of rows of data but only a handful of invoice
numbers. I need to find the average of the days based on the unique count of
the invoice numbers. I already have my formula for the unique count but now
need one for the average when the invoice numbers are not in contiguous cells
down the column.

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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Average If...

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data pertaining to
each one. So one invoice number could have 10 rows of data pertaining to
it
so the invoice number will be repeated 10 times. Then on each line is the
time it took to receive the data so this number will be the same on all 10
lines. I have hundreds of rows of data but only a handful of invoice
numbers. I need to find the average of the days based on the unique count
of
the invoice numbers. I already have my formula for the unique count but
now
need one for the average when the invoice numbers are not in contiguous
cells
down the column.

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.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 216
Default Average If...

Didn't work. :( Result was #N/A as an array formula. Thanks for trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data pertaining to
each one. So one invoice number could have 10 rows of data pertaining to
it
so the invoice number will be repeated 10 times. Then on each line is the
time it took to receive the data so this number will be the same on all 10
lines. I have hundreds of rows of data but only a handful of invoice
numbers. I need to find the average of the days based on the unique count
of
the invoice numbers. I already have my formula for the unique count but
now
need one for the average when the invoice numbers are not in contiguous
cells
down the column.

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.



.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Average If...

Here's a small sample file using your posted data that demonstrates this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks for trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data pertaining
to
each one. So one invoice number could have 10 rows of data pertaining
to
it
so the invoice number will be repeated 10 times. Then on each line is
the
time it took to receive the data so this number will be the same on all
10
lines. I have hundreds of rows of data but only a handful of invoice
numbers. I need to find the average of the days based on the unique
count
of
the invoice numbers. I already have my formula for the unique count
but
now
need one for the average when the invoice numbers are not in contiguous
cells
down the column.

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.



.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 216
Default Average If...

You are correct. I should have thought of that. They are alpha numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks for trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data pertaining
to
each one. So one invoice number could have 10 rows of data pertaining
to
it
so the invoice number will be repeated 10 times. Then on each line is
the
time it took to receive the data so this number will be the same on all
10
lines. I have hundreds of rows of data but only a handful of invoice
numbers. I need to find the average of the days based on the unique
count
of
the invoice numbers. I already have my formula for the unique count
but
now
need one for the average when the invoice numbers are not in contiguous
cells
down the column.

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.


.



.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Average If...

Ok, for alphnumerics try this array formula** :

=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A 2: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" wrote in message
...
You are correct. I should have thought of that. They are alpha numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks for
trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data
pertaining
to
each one. So one invoice number could have 10 rows of data
pertaining
to
it
so the invoice number will be repeated 10 times. Then on each line
is
the
time it took to receive the data so this number will be the same on
all
10
lines. I have hundreds of rows of data but only a handful of
invoice
numbers. I need to find the average of the days based on the unique
count
of
the invoice numbers. I already have my formula for the unique count
but
now
need one for the average when the invoice numbers are not in
contiguous
cells
down the column.

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.


.



.



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 193
Default Average If...

Of course! Neater than mine, and (like mine) doesn't need to be array
entered. Still suffers from the need for OFFSET() to allow for increasing
range lengths.

Nice one.


"T. Valko" wrote in message
...
Ok, for alphnumerics try this array formula** :

=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A 2: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" wrote in message
...
You are correct. I should have thought of that. They are alpha numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates
this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks for
trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data
pertaining
to
each one. So one invoice number could have 10 rows of data
pertaining
to
it
so the invoice number will be repeated 10 times. Then on each line
is
the
time it took to receive the data so this number will be the same on
all
10
lines. I have hundreds of rows of data but only a handful of
invoice
numbers. I need to find the average of the days based on the
unique
count
of
the invoice numbers. I already have my formula for the unique
count
but
now
need one for the average when the invoice numbers are not in
contiguous
cells
down the column.

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.


.



.




  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Average If...

Still suffers from the need for OFFSET() to
allow for increasing range lengths.


If they need dynamic ranges I would create those using InsertNameDefine
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" wrote in message
...
Of course! Neater than mine, and (like mine) doesn't need to be array
entered. Still suffers from the need for OFFSET() to allow for increasing
range lengths.

Nice one.


"T. Valko" wrote in message
...
Ok, for alphnumerics try this array formula** :

=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A 2: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" wrote in message
...
You are correct. I should have thought of that. They are alpha numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates
this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks for
trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data
pertaining
to
each one. So one invoice number could have 10 rows of data
pertaining
to
it
so the invoice number will be repeated 10 times. Then on each
line is
the
time it took to receive the data so this number will be the same
on all
10
lines. I have hundreds of rows of data but only a handful of
invoice
numbers. I need to find the average of the days based on the
unique
count
of
the invoice numbers. I already have my formula for the unique
count
but
now
need one for the average when the invoice numbers are not in
contiguous
cells
down the column.

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.


.



.






  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 193
Default Average If...

Curious... why?

"T. Valko" wrote in message
...
Still suffers from the need for OFFSET() to
allow for increasing range lengths.


If they need dynamic ranges I would create those using InsertNameDefine
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" wrote in message
...
Of course! Neater than mine, and (like mine) doesn't need to be array
entered. Still suffers from the need for OFFSET() to allow for
increasing range lengths.

Nice one.


"T. Valko" wrote in message
...
Ok, for alphnumerics try this array formula** :

=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A 2: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" wrote in message
...
You are correct. I should have thought of that. They are alpha
numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates
this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks for
trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data
pertaining
to
each one. So one invoice number could have 10 rows of data
pertaining
to
it
so the invoice number will be repeated 10 times. Then on each
line is
the
time it took to receive the data so this number will be the same
on all
10
lines. I have hundreds of rows of data but only a handful of
invoice
numbers. I need to find the average of the days based on the
unique
count
of
the invoice numbers. I already have my formula for the unique
count
but
now
need one for the average when the invoice numbers are not in
contiguous
cells
down the column.

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.


.



.







  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Average If...

Using named dynamic ranges will make the formula shorter and will be easier
to read and understand. And, if using INDEX to define those ranges, the
formula won't be volatile.

--
Biff
Microsoft Excel MVP


"Steve Dunn" wrote in message
...
Curious... why?

"T. Valko" wrote in message
...
Still suffers from the need for OFFSET() to
allow for increasing range lengths.


If they need dynamic ranges I would create those using InsertNameDefine
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" wrote in message
...
Of course! Neater than mine, and (like mine) doesn't need to be array
entered. Still suffers from the need for OFFSET() to allow for
increasing range lengths.

Nice one.


"T. Valko" wrote in message
...
Ok, for alphnumerics try this array formula** :

=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A 2: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" wrote in message
...
You are correct. I should have thought of that. They are alpha
numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates
this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks for
trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data
pertaining
to
each one. So one invoice number could have 10 rows of data
pertaining
to
it
so the invoice number will be repeated 10 times. Then on each
line is
the
time it took to receive the data so this number will be the same
on all
10
lines. I have hundreds of rows of data but only a handful of
invoice
numbers. I need to find the average of the days based on the
unique
count
of
the invoice numbers. I already have my formula for the unique
count
but
now
need one for the average when the invoice numbers are not in
contiguous
cells
down the column.

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.


.



.











  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 193
Default Average If...

Can you show how one of our formulae can use INDEX instead of OFFSET in this
instance? I've tried:

$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" wrote in message
...
Using named dynamic ranges will make the formula shorter and will be
easier to read and understand. And, if using INDEX to define those ranges,
the formula won't be volatile.

--
Biff
Microsoft Excel MVP


"Steve Dunn" wrote in message
...
Curious... why?

"T. Valko" wrote in message
...
Still suffers from the need for OFFSET() to
allow for increasing range lengths.

If they need dynamic ranges I would create those using
InsertNameDefine 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" wrote in message
...
Of course! Neater than mine, and (like mine) doesn't need to be array
entered. Still suffers from the need for OFFSET() to allow for
increasing range lengths.

Nice one.


"T. Valko" wrote in message
...
Ok, for alphnumerics try this array formula** :

=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A 2: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" wrote in message
...
You are correct. I should have thought of that. They are alpha
numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates
this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks for
trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data
pertaining
to
each one. So one invoice number could have 10 rows of data
pertaining
to
it
so the invoice number will be repeated 10 times. Then on each
line is
the
time it took to receive the data so this number will be the
same on all
10
lines. I have hundreds of rows of data but only a handful of
invoice
numbers. I need to find the average of the days based on the
unique
count
of
the invoice numbers. I already have my formula for the unique
count
but
now
need one for the average when the invoice numbers are not in
contiguous
cells
down the column.

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.


.



.










  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Average If...

Let's assume the data is in the following ranges:

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(Sheet 1!$A$2:$A$100))

Days
Refers to:

=Sheet1!$B$2:INDEX(Sheet1!$B$2:$B$100,COUNTA(Sheet 1!$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" wrote in message
...
Can you show how one of our formulae can use INDEX instead of OFFSET in
this instance? I've tried:

$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" wrote in message
...
Using named dynamic ranges will make the formula shorter and will be
easier to read and understand. And, if using INDEX to define those
ranges, the formula won't be volatile.

--
Biff
Microsoft Excel MVP


"Steve Dunn" wrote in message
...
Curious... why?

"T. Valko" wrote in message
...
Still suffers from the need for OFFSET() to
allow for increasing range lengths.

If they need dynamic ranges I would create those using
InsertNameDefine 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" wrote in message
...
Of course! Neater than mine, and (like mine) doesn't need to be array
entered. Still suffers from the need for OFFSET() to allow for
increasing range lengths.

Nice one.


"T. Valko" wrote in message
...
Ok, for alphnumerics try this array formula** :

=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A 2: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" wrote in message
...
You are correct. I should have thought of that. They are alpha
numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates
this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks
for trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data
pertaining
to
each one. So one invoice number could have 10 rows of data
pertaining
to
it
so the invoice number will be repeated 10 times. Then on each
line is
the
time it took to receive the data so this number will be the
same on all
10
lines. I have hundreds of rows of data but only a handful of
invoice
numbers. I need to find the average of the days based on the
unique
count
of
the invoice numbers. I already have my formula for the unique
count
but
now
need one for the average when the invoice numbers are not in
contiguous
cells
down the column.

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.


.



.












  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 193
Default Average If...

Correction, this does work (in both formulae), and I have no idea why it
gave the div/0 error yesterday...
Oh well, onwards and (possibly) upwards.


"Steve Dunn" wrote in message
...
Can you show how one of our formulae can use INDEX instead of OFFSET in
this instance? I've tried:

$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" wrote in message
...
Using named dynamic ranges will make the formula shorter and will be
easier to read and understand. And, if using INDEX to define those
ranges, the formula won't be volatile.

--
Biff
Microsoft Excel MVP


"Steve Dunn" wrote in message
...
Curious... why?

"T. Valko" wrote in message
...
Still suffers from the need for OFFSET() to
allow for increasing range lengths.

If they need dynamic ranges I would create those using
InsertNameDefine 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" wrote in message
...
Of course! Neater than mine, and (like mine) doesn't need to be array
entered. Still suffers from the need for OFFSET() to allow for
increasing range lengths.

Nice one.


"T. Valko" wrote in message
...
Ok, for alphnumerics try this array formula** :

=AVERAGE(IF(FREQUENCY(MATCH(A2:A10,A2:A10,0),ROW(A 2: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" wrote in message
...
You are correct. I should have thought of that. They are alpha
numeric
sometimes with a dash.

"T. Valko" wrote:

Here's a small sample file using your posted data that demonstrates
this.

zNadine.xls 14kb

http://cjoint.com/?eCdSeTo64Y

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" wrote in message
...
Didn't work. :( Result was #N/A as an array formula. Thanks
for trying.

"T. Valko" wrote:

Try this array formula** :

=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" wrote in message
...
I have a column of invoice numbers and multiple rows of data
pertaining
to
each one. So one invoice number could have 10 rows of data
pertaining
to
it
so the invoice number will be repeated 10 times. Then on each
line is
the
time it took to receive the data so this number will be the
same on all
10
lines. I have hundreds of rows of data but only a handful of
invoice
numbers. I need to find the average of the days based on the
unique
count
of
the invoice numbers. I already have my formula for the unique
count
but
now
need one for the average when the invoice numbers are not in
contiguous
cells
down the column.

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.


.



.











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A formula to AVERAGE IF but only average a set number of values [email protected] Excel Worksheet Functions 2 January 31st 08 08:28 PM
Find monthly average but have average automatically configured kimbafred Excel Discussion (Misc queries) 2 August 8th 07 12:28 AM
Error Handling #N/A with AVERAGE Function - Average of values in Row Sam via OfficeKB.com Excel Worksheet Functions 13 July 31st 05 03:59 PM
Weighed Average of a weiged average when there are blanks krl - ExcelForums.com Excel Discussion (Misc queries) 1 July 6th 05 07:37 PM
how does one convert text to a formula "average(A:A)" to =average( phshirk Excel Worksheet Functions 4 April 14th 05 01:20 AM


All times are GMT +1. The time now is 04:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"