Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
jbaker
 
Posts: n/a
Default How do I set up an If statement to look beyond the previous cell .

I need an If statement that allows me to calculate a value without having to
have an entry in each cell to calculate with. Then I need to be able to
figure an average using all cells included in the range and have that number
fill the cells in the column that correspond to the cells in the range used
for the average. I.E. If I have a value on day 1, but don't have a value to
enter until day 5, I need to use those two values to calculate a value. Now I
need to average that value using all of the days.

Can an If statement do that?
  #2   Report Post  
Myrna Larson
 
Posts: n/a
Default

As it says in Help, the AVERAGE function ignores blank cells.

On Tue, 1 Mar 2005 21:09:04 -0800, jbaker
wrote:

I need an If statement that allows me to calculate a value without having to
have an entry in each cell to calculate with. Then I need to be able to
figure an average using all cells included in the range and have that number
fill the cells in the column that correspond to the cells in the range used
for the average. I.E. If I have a value on day 1, but don't have a value to
enter until day 5, I need to use those two values to calculate a value. Now I
need to average that value using all of the days.

Can an If statement do that?


  #3   Report Post  
jbaker
 
Posts: n/a
Default

In addition, the worksheet has text cells to differentiate the months in the
column with values. I have a simple VB script that works in a macro until it
encounters the text cells. Also, I would like this to run automatically
without having to envoke a macro. Is there a way to do this?

Thanks!

"jbaker" wrote:

I need an If statement that allows me to calculate a value without having to
have an entry in each cell to calculate with. Then I need to be able to
figure an average using all cells included in the range and have that number
fill the cells in the column that correspond to the cells in the range used
for the average. I.E. If I have a value on day 1, but don't have a value to
enter until day 5, I need to use those two values to calculate a value. Now I
need to average that value using all of the days.

Can an If statement do that?

  #4   Report Post  
GaryDK
 
Posts: n/a
Default

I can think of two ways to handle your problem as i understand it. (The
first problem, not the VBA one.)

Assuming you have 5 cells in cells A1 to E1, you could enter the
following formula in, say, H1, and then copy it to I1 thru L1 5:

=if(isblank(A1),0,[your formula operating on A1])

Then in cell F1, you can enter:

= AVERAGE(H1:L1)

The other, more complex way, one which you may not want to mess with,
is to enter an array formula. So, for example, if your formula
operation is to square each cell value and add 5 to it, enter this
formula in a cell and press Ctrl+Shift+Enter:

=AVERAGE(IF(NOT(ISBLANK(A1:E1)),(A1:E1)^2+5,0))

The formula will be entered *by Excel* (not by you!) with curly braces
"{}' when you finish entering it by pressing Ctrl+Shift+Enter. Note the
portion where your formula operation is, i.e., the "(A1:E1)^2+5" part.
You didn't specify what your formula is, but if you enter "(A1:E1)"
where you would normally enter a single cell address, it should do the
job.

Clear as mud? Then stick with the first solution. I probably would!

I hope this helps,

Gary

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
What statement to use? Paul Excel Worksheet Functions 6 February 13th 05 05:23 PM
How do I fix a circular reference in a financial statement? drjayhawk25 Excel Discussion (Misc queries) 0 February 7th 05 05:19 PM
IF Statement with Average Function results in #Value! Paul Excel Discussion (Misc queries) 5 December 28th 04 08:11 AM
7+ nested if statement? Turi Excel Worksheet Functions 3 December 20th 04 07:55 PM
Statement lintan Excel Worksheet Functions 1 December 2nd 04 11:31 PM


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

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"