Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 31
Default I need to know only the last 4 numbers, but these change weekly.

I have a spreadsheet which gives me the following information, if there is no
data insert 0 - This is ok and works. The next bit asks if there are less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the bottom of
my column, and work back up, identifying the first 4 cells with data in them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six empty
rows followed by 500, a blank and then 650. So the formula would find 650,
500,900,700, returning for me at the top of the sheet the figure 687.5 - help
anyone
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default I need to know only the last 4 numbers, but these change weekly.

Hi,

Let's say your data are in the range B1 - B1000. This will give the average
of the bottom 4 numeric cells:-

=AVERAGE(IF(ROW(B1:B1000)=LARGE(IF(ISNUMBER(B1:B1 000),IF(B1:B10000,ROW(B1:B1000))),MIN(4,COUNTIF(B 1:B1000,"0"))),IF(B1:B10000,B1:B1000)))

It's an array so enter with Ctrl+Shift+Enter

Mike

"dartanion" wrote:

I have a spreadsheet which gives me the following information, if there is no
data insert 0 - This is ok and works. The next bit asks if there are less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the bottom of
my column, and work back up, identifying the first 4 cells with data in them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six empty
rows followed by 500, a blank and then 650. So the formula would find 650,
500,900,700, returning for me at the top of the sheet the figure 687.5 - help
anyone

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default I need to know only the last 4 numbers, but these change weekly.

Try something like this

This regular formula returns the average of up to the last 4 numbers in the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if there is
no
data insert 0 - This is ok and works. The next bit asks if there are less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the bottom
of
my column, and work back up, identifying the first 4 cells with data in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six
empty
rows followed by 500, a blank and then 650. So the formula would find 650,
500,900,700, returning for me at the top of the sheet the figure 687.5 -
help
anyone



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default I need to know only the last 4 numbers, but these change weekl

Ron,

Simpler than mine but can it be modified to give the correct result if there
is a non-numeric value in the range? My understanding is that this formula
takes the last 4 values in a range (not necessarily the last 4 numeric
values) and averages them if they are numeric.

Mike

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers in the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if there is
no
data insert 0 - This is ok and works. The next bit asks if there are less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the bottom
of
my column, and work back up, identifying the first 4 cells with data in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six
empty
rows followed by 500, a blank and then 650. So the formula would find 650,
500,900,700, returning for me at the top of the sheet the figure 687.5 -
help
anyone




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default I need to know only the last 4 numbers, but these change weekl

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range?


It depends on the user's needs. In the posted example, there were numbers
and blanks....no text. Consequently, I tailored the solution to that
scenario.

If text may sneak into the range, this adjusted version works:
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE(ISNUMBER(B1:B28)*ROW(B1:B28),4),0))),0)

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)


"Mike H" wrote in message
...
Ron,

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range? My understanding is that this formula
takes the last 4 values in a range (not necessarily the last 4 numeric
values) and averages them if they are numeric.

Mike

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers in
the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if there
is
no
data insert 0 - This is ok and works. The next bit asks if there are
less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the
bottom
of
my column, and work back up, identifying the first 4 cells with data in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six
empty
rows followed by 500, a blank and then 650. So the formula would find
650,
500,900,700, returning for me at the top of the sheet the figure
687.5 -
help
anyone








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default I need to know only the last 4 numbers, but these change weekl

=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*(ISNUMBER(B1:B28))*ROW(B1:B28),4 ),0))),0)


--
Regards,

Peo Sjoblom



"Mike H" wrote in message
...
Ron,

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range? My understanding is that this formula
takes the last 4 values in a range (not necessarily the last 4 numeric
values) and averages them if they are numeric.

Mike

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers in
the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if there
is
no
data insert 0 - This is ok and works. The next bit asks if there are
less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the
bottom
of
my column, and work back up, identifying the first 4 cells with data in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six
empty
rows followed by 500, a blank and then 650. So the formula would find
650,
500,900,700, returning for me at the top of the sheet the figure
687.5 -
help
anyone






  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default I need to know only the last 4 numbers, but these change weekl

Ron,

Thank you for that. I wasn't questioning the accuracy of your reply to the
OP, I just wanted to know whether the non-array solution could cope with text
in the range.

Mike

"Ron Coderre" wrote:

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range?


It depends on the user's needs. In the posted example, there were numbers
and blanks....no text. Consequently, I tailored the solution to that
scenario.

If text may sneak into the range, this adjusted version works:
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE(ISNUMBER(B1:B28)*ROW(B1:B28),4),0))),0)

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)


"Mike H" wrote in message
...
Ron,

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range? My understanding is that this formula
takes the last 4 values in a range (not necessarily the last 4 numeric
values) and averages them if they are numeric.

Mike

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers in
the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if there
is
no
data insert 0 - This is ok and works. The next bit asks if there are
less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the
bottom
of
my column, and work back up, identifying the first 4 cells with data in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six
empty
rows followed by 500, a blank and then 650. So the formula would find
650,
500,900,700, returning for me at the top of the sheet the figure
687.5 -
help
anyone






  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 31
Default I need to know only the last 4 numbers, but these change weekl

Ron thanks, but it brought an error message up,. The reply from Mike worked
perfectly

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers in the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if there is
no
data insert 0 - This is ok and works. The next bit asks if there are less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the bottom
of
my column, and work back up, identifying the first 4 cells with data in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six
empty
rows followed by 500, a blank and then 650. So the formula would find 650,
500,900,700, returning for me at the top of the sheet the figure 687.5 -
help
anyone




  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 31
Default I need to know only the last 4 numbers, but these change weekl

Thanks very much, your help is much appreciated. The one from Mike worked
perfectly.

"Peo Sjoblom" wrote:

=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*(ISNUMBER(B1:B28))*ROW(B1:B28),4 ),0))),0)


--
Regards,

Peo Sjoblom



"Mike H" wrote in message
...
Ron,

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range? My understanding is that this formula
takes the last 4 values in a range (not necessarily the last 4 numeric
values) and averages them if they are numeric.

Mike

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers in
the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if there
is
no
data insert 0 - This is ok and works. The next bit asks if there are
less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the
bottom
of
my column, and work back up, identifying the first 4 cells with data in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six
empty
rows followed by 500, a blank and then 650. So the formula would find
650,
500,900,700, returning for me at the top of the sheet the figure
687.5 -
help
anyone






  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 31
Default I need to know only the last 4 numbers, but these change weekl

Mike
Icant thank you enough, it works a treat.

"Mike H" wrote:

Hi,

Let's say your data are in the range B1 - B1000. This will give the average
of the bottom 4 numeric cells:-

=AVERAGE(IF(ROW(B1:B1000)=LARGE(IF(ISNUMBER(B1:B1 000),IF(B1:B10000,ROW(B1:B1000))),MIN(4,COUNTIF(B 1:B1000,"0"))),IF(B1:B10000,B1:B1000)))

It's an array so enter with Ctrl+Shift+Enter

Mike

"dartanion" wrote:

I have a spreadsheet which gives me the following information, if there is no
data insert 0 - This is ok and works. The next bit asks if there are less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the bottom of
my column, and work back up, identifying the first 4 cells with data in them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six empty
rows followed by 500, a blank and then 650. So the formula would find 650,
500,900,700, returning for me at the top of the sheet the figure 687.5 - help
anyone



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default I need to know only the last 4 numbers, but these change weekl

I didn't think you were questioning the accuracy, Mike. It was a good
question and prompted me to tweak the formula so it avoids being tripped up
by inadvertent text in the range. Thanks.

Best Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)



"Mike H" wrote in message
...
Ron,

Thank you for that. I wasn't questioning the accuracy of your reply to the
OP, I just wanted to know whether the non-array solution could cope with
text
in the range.

Mike

"Ron Coderre" wrote:

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range?


It depends on the user's needs. In the posted example, there were
numbers
and blanks....no text. Consequently, I tailored the solution to that
scenario.

If text may sneak into the range, this adjusted version works:
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE(ISNUMBER(B1:B28)*ROW(B1:B28),4),0))),0)

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)


"Mike H" wrote in message
...
Ron,

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range? My understanding is that this
formula
takes the last 4 values in a range (not necessarily the last 4 numeric
values) and averages them if they are numeric.

Mike

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers
in
the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if
there
is
no
data insert 0 - This is ok and works. The next bit asks if there are
less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the
bottom
of
my column, and work back up, identifying the first 4 cells with data
in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty
rows
followed by cells with 400, 700, a couple of blanks then 900 then
six
empty
rows followed by 500, a blank and then 650. So the formula would
find
650,
500,900,700, returning for me at the top of the sheet the figure
687.5 -
help
anyone








  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 31
Default I need to know only the last 4 numbers, but these change weekl

Just tried it out, and used the following series 89, 90, 90, 76, 76, 76, 76
expecting the answer to be 76 but got 81.1. But many thanks for the try.

"Peo Sjoblom" wrote:

=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*(ISNUMBER(B1:B28))*ROW(B1:B28),4 ),0))),0)


--
Regards,

Peo Sjoblom



"Mike H" wrote in message
...
Ron,

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range? My understanding is that this formula
takes the last 4 values in a range (not necessarily the last 4 numeric
values) and averages them if they are numeric.

Mike

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers in
the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if there
is
no
data insert 0 - This is ok and works. The next bit asks if there are
less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the
bottom
of
my column, and work back up, identifying the first 4 cells with data in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty rows
followed by cells with 400, 700, a couple of blanks then 900 then six
empty
rows followed by 500, a blank and then 650. So the formula would find
650,
500,900,700, returning for me at the top of the sheet the figure
687.5 -
help
anyone






  #13   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default I need to know only the last 4 numbers, but these change weekl

Really? I got 76. Btw, it's not a try, I know it works


--
Regards,

Peo Sjoblom



"dartanion" wrote in message
...
Just tried it out, and used the following series 89, 90, 90, 76, 76, 76,
76
expecting the answer to be 76 but got 81.1. But many thanks for the try.

"Peo Sjoblom" wrote:

=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*(ISNUMBER(B1:B28))*ROW(B1:B28),4 ),0))),0)


--
Regards,

Peo Sjoblom



"Mike H" wrote in message
...
Ron,

Simpler than mine but can it be modified to give the correct result if
there
is a non-numeric value in the range? My understanding is that this
formula
takes the last 4 values in a range (not necessarily the last 4 numeric
values) and averages them if they are numeric.

Mike

"Ron Coderre" wrote:

Try something like this

This regular formula returns the average of up to the last 4 numbers
in
the
range B1:B28.
(If there are no numbers, it returns zero):
=IF(COUNT(B1:B28),AVERAGE(B28:INDEX(B1:B28,INDEX(L ARGE((B1:B28<"")*ROW(B1:B28),4),0))),0)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

(XL2003, Win XP)

"dartanion" wrote in message
...
I have a spreadsheet which gives me the following information, if
there
is
no
data insert 0 - This is ok and works. The next bit asks if there are
less
than 5 entries, what is the average, again this formula works ok.
The next bit completely baffles me. All I want is to start at the
bottom
of
my column, and work back up, identifying the first 4 cells with data
in
them,
add them together and give me the average.
eg column b has ten empty rows, then the number 600, then 3 empty
rows
followed by cells with 400, 700, a couple of blanks then 900 then
six
empty
rows followed by 500, a blank and then 650. So the formula would
find
650,
500,900,700, returning for me at the top of the sheet the figure
687.5 -
help
anyone








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
Excel Bi-weekly time sheet change dates to Thursday- Wednesday? cainart New Users to Excel 13 July 25th 07 12:50 PM
Updating info from 2 workbooks where file naness change weekly bpwin Excel Worksheet Functions 0 March 14th 07 08:46 PM
Need a formula to change data result weekly. Karen K Excel Worksheet Functions 5 February 24th 07 03:47 PM
can I configure Conditional formatting to change color weekly? Joe Excel Discussion (Misc queries) 4 February 21st 07 09:48 PM
with weekly score sheet how do I column a weekly progressive aver. tom Excel Worksheet Functions 2 September 21st 06 08:13 AM


All times are GMT +1. The time now is 12:10 PM.

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

About Us

"It's about Microsoft Excel"