Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default How do I avoid repeating calculation in IF function?

I use a calculation that sometimes (legitimately) returns the error code
#N/A. When this happens, I want a blank stored in the cell. So:
IF(ISNA(calculation),"",calculation)
Is there some way of avoiding the second calculation?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default How do I avoid repeating calculation in IF function?


Depends on your version of Excel, and what the calculation you are making is.

2007:

=IFERROR(Calculation,"")

for 2003 you will need to tell us the calculation. If it is VLOOKUP then
the answer is probably no.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Arthur" wrote:

I use a calculation that sometimes (legitimately) returns the error code
#N/A. When this happens, I want a blank stored in the cell. So:
IF(ISNA(calculation),"",calculation)
Is there some way of avoiding the second calculation?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default How do I avoid repeating calculation in IF function?

Hi,

Depends on your version of Excel, and what the calculation you are making is.

2007:

=IFERROR(Calculation,"")

for 2003 you will need to tell us the calculation. If it is VLOOKUP then
the answer is probably no.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Arthur" wrote:

I use a calculation that sometimes (legitimately) returns the error code
#N/A. When this happens, I want a blank stored in the cell. So:
IF(ISNA(calculation),"",calculation)
Is there some way of avoiding the second calculation?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,104
Default How do I avoid repeating calculation in IF function?

If this is just for cosmetic purposes, you could leave out the IF and use
conditional formatting to hide the #N/A when it occurs.
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Arthur" wrote in message
...
I use a calculation that sometimes (legitimately) returns the error code
#N/A. When this happens, I want a blank stored in the cell. So:
IF(ISNA(calculation),"",calculation)
Is there some way of avoiding the second calculation?



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How do I avoid repeating calculation in IF function?

It all depends on what your formula looks like.

Sometimes, instead of repeating the formula like this:

=IF(ISNA(formula),"",formula)

You can reduce the error trap to the specific portion of the formula that
actually generates the error. For example:

=IF(ISNA(VLOOKUP(A1,X:Y,2,0)),"",VLOOKUP(A1,X:Y,2, 0))

In this case we know an error will be generated if the lookup value A1
doesn't exist in the lookup table column X. While we can't completely
eliminate** a double formula we can make it more efficient and save a few
keystrokes at the same time:

=IF(COUNTIF(X:X,A1),VLOOKUP(A1,X:Y,2,0),"")

** Excel 2007 comes with a new error testing function called IFERROR. Using
that function combined with the above VLOOKUP formula:

=IFERROR(VLOOKUP(A1,X:Y,2,0),"")

In this case we did eliminate the double formula. However, this is not
always the most efficient method to use on really long complex formulas.

--
Biff
Microsoft Excel MVP


"Arthur" wrote in message
...
I use a calculation that sometimes (legitimately) returns the error code
#N/A. When this happens, I want a blank stored in the cell. So:
IF(ISNA(calculation),"",calculation)
Is there some way of avoiding the second calculation?





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default How do I avoid repeating calculation in IF function?


"T. Valko" wrote in message
...
It all depends on what your formula looks like.

Sometimes, instead of repeating the formula like this:

=IF(ISNA(formula),"",formula)

You can reduce the error trap to the specific portion of the formula that
actually generates the error.


There is an easier way.
Put the formula in a different cell, then test the result of that.
For example, instead of putting
=IF(ISNA(VLOOKUP(A1,X:Y,2,0)),"",VLOOKUP(A1,X:Y,2, 0))
in cell B2, put
=VLOOKUP(A1,X:Y,2,0)
in B1, and
=IF(ISNA(B1),"",B1)
in B2.



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
avoid nested IFs with another function pda Excel Worksheet Functions 4 August 24th 08 05:44 AM
can i avoid repeating rows when adding calculated item in pivot ta sophie Excel Worksheet Functions 4 January 7th 08 07:50 AM
Make unique cells - Avoid repeating Values Mary Excel Discussion (Misc queries) 1 January 30th 07 09:03 PM
How do you avoid duplicates when using the randbetween function? Monica Excel Worksheet Functions 2 February 16th 06 05:45 AM
Avoid geeting function GETPIVOTDATA Gunnar Sandström Excel Discussion (Misc queries) 2 January 18th 06 01:19 PM


All times are GMT +1. The time now is 01:29 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"