Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus batch bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory monitor motherboard mouse network operating system printer problem ram registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: Quick formula question

Reply  
Thread Tools
theseus75's Avatar
Member with 274 posts.
 
Join Date: Jan 2005
Experience: Intermediate
11-Nov-2009, 10:48 AM #1
Solved: Quick formula question
I have a spreadsheet with an average line that can sometimes have no values. Thus, the average line reads #DIV/0. When charted, however, this shows up the same as a zero as opposed to there being no value.

Thus, I'd like to add something to the average formula to tell it: If #DIV/0, then blank. I would normally handle this with a macro replacing all #DIV/0s with blanks, but - as you may know - that doesn't work with a formula; it would have to be the literal value of the cell.

I'm using Excel 2003 on Windows XP w/ SP3, but the way.

Here's an example:

Part 1 Part 2 Part 3
100%
100%
100%
100%
100% 0%
100%
100% 50% #DIV/0! Average Line

And of course the formula now just reads: =AVERAGE(A1:A7), etc.

Thanks!
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
11-Nov-2009, 11:28 AM #2
Well, the following:
=IF(ISERROR(AVERAGE(A1:A7)),"",AVERAGE(A1:A7))
will show a blank rather than an error (or you could put text in instead, such as
=IF(ISERROR(AVERAGE(A1:A7)),"You can't divide by zero",AVERAGE(A1:A7))
but I am not sure that is what you want.
__________________
Iowa? I could have sworn this was heaven.
Well, I think I can answer this question most successfully in mime.
My theme song... | Affero - rate me!
Aj_old's Avatar
Computer Specs
Senior Member with 869 posts.
 
Join Date: Sep 2007
Location: Moldova
Experience: Intermediate
11-Nov-2009, 11:40 AM #3
Or you could use this formula:
Code:
=IF(count(A1:A7)>0),AVERAGE(A1:A7),"")
theseus75's Avatar
Member with 274 posts.
 
Join Date: Jan 2005
Experience: Intermediate
11-Nov-2009, 11:42 AM #4
Thanks slurpee:

Well, I put that in, and it indeed leaves the cell empty but for the formula. Alas, when charted, it still sees it (and displays it) the same as a zero. This is problematic b/c if there was an actual 0 for the measure, that's far different than having no cases for the measure (where the #DIV/0 would come in).

I mean, I could add to the macro - factoring the average, copying the results, pasting as values only, and THEN doing the find/replace of #DIV/0 for a blank cell, but I'd be surprised if there weren't another way.

Thanks.
theseus75's Avatar
Member with 274 posts.
 
Join Date: Jan 2005
Experience: Intermediate
11-Nov-2009, 11:45 AM #5
Aj_Old:

I'm getting an error on that, albeit it could be operator error.
Aj_old's Avatar
Computer Specs
Senior Member with 869 posts.
 
Join Date: Sep 2007
Location: Moldova
Experience: Intermediate
11-Nov-2009, 11:52 AM #6
You are right, it should be:
Code:
=IF(count(A1:A7)>0,AVERAGE(A1:A7),"")
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
11-Nov-2009, 11:53 AM #7
I made a chart as well, and got no listing for the division error - except as part of the name for the series.
Maybe you could upload a sample file (fake data, please) so we can see what is happening?
theseus75's Avatar
Member with 274 posts.
 
Join Date: Jan 2005
Experience: Intermediate
11-Nov-2009, 12:25 PM #8
Here's a sample
Okay, here's a sample where the first few columns are just the average formula, the fifth is blank (nothing in the cell), and 6th and 7th have Slurpee's and Aj_Old's formulas respectively.

So when there's nothing to average, I'd want it to look like column 5: nothing there at all.

Thanks for the help; let me know if you need more details.
Attached Files
File Type: xls sample.xls (18.5 KB, 80 views)
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 5,030 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
11-Nov-2009, 12:44 PM #9
You could force an N/A error, and then use the skip N/A's tool by Tushar Mehta...

http://www.tushar-mehta.com/excel/so...ity/index.html

This works in 2003, but does NOT work in 2007 (yet).

What I mean by force an N/A is to use the formula in your IF() condition...

Code:
NA()
HTH
theseus75's Avatar
Member with 274 posts.
 
Join Date: Jan 2005
Experience: Intermediate
11-Nov-2009, 01:14 PM #10
Zack: I installed the Add-in, and now #N/As indeed show up as nothing at all on charts. However, I don't know how to put this into a formula; don't mean to be an Excel newb, but could you flesh out the code a little more?

Cause using something like:

=IF(COUNT(U73:U84)>0,AVERAGE(U73:U84),"#N/A")

Puts in #N/A literally, but Excel still charts it as a 0. Whereas a #N/A caused by, say, a VLOOOKUP doesn't chart at all (which is what I want).

Thanks.
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 5,030 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
11-Nov-2009, 01:22 PM #11
You could use the NA() formula is what I meant, sorry for not clarifying...
Code:
=IF(COUNT(U73:U84)>0,AVERAGE(U73:U84),NA())
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
11-Nov-2009, 01:44 PM #12
This would also work - in row 12, enter this formula and drag it across, and base your graph on these values, not on row 10:
=IF(B10="",#N/A, B10)
Any column with a "0" actually in it will still show as a zero, but since text is not a value, the #N/A will not register.
You could hide row 12 if you preferred.
__________________
Iowa? I could have sworn this was heaven.
Well, I think I can answer this question most successfully in mime.
My theme song... | Affero - rate me!
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 5,030 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
11-Nov-2009, 01:45 PM #13
Forcing an error with an error. ROFLMAO!!! Too creative.
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
11-Nov-2009, 01:48 PM #14
What the heck, it works! - Oh, note, that is based on using the first formula I gave, or AJ's in row 10.
And you knew I think in, um, strange ways....
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 5,030 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
11-Nov-2009, 01:56 PM #15
Well, I think it's the most ingenious/hilarious/by-product solution I've ever seen in a formula.
Reply

Tags
excel, formula

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:55 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.