Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, i have some VBA code in the custom-made formula Getprice(Date;ProductCode) that fetch data from a db and return either a number or an error (by means of a text explanation) I would like to return #N/A when there is an error and the value otherwise. The problem is that if i write: Getprice = "#N/A" excel puts in the calling cell mere text and in the sheet #N/A isn't considered as a real NOT AVAILABLE ... Therefore if I sum that cell with another containing a number it doesn't show #N/A but simply avoid considering the cell containing #N/A in the calculation of the sum ... Thanks in advance for your help Sorry for my bad english Paolo Italy -- kayard ------------------------------------------------------------------------ kayard's Profile: http://www.excelforum.com/member.php...o&userid=24716 View this thread: http://www.excelforum.com/showthread...hreadid=569327 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ho Paolo,
CVErr(xlErrNA) -- Kind regards, Niek Otten Microsoft MVP - Excel "kayard" wrote in message ... | | Hi, | | i have some VBA code in the custom-made formula | Getprice(Date;ProductCode) that fetch data from a db and return either | a number or an error (by means of a text explanation) I would like to | return #N/A when there is an error and the value otherwise. The problem | is that if i write: | | Getprice = "#N/A" | | excel puts in the calling cell mere text and in the sheet #N/A isn't | considered as a real NOT AVAILABLE ... Therefore if I sum that cell | with another containing a number it doesn't show #N/A but simply avoid | considering the cell containing #N/A in the calculation of the sum ... | | Thanks in advance for your help | | Sorry for my bad english | | Paolo | | Italy | | | -- | kayard | ------------------------------------------------------------------------ | kayard's Profile: http://www.excelforum.com/member.php...o&userid=24716 | View this thread: http://www.excelforum.com/showthread...hreadid=569327 | |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Check out CVErr function in the help and various built-in xlErr Enum values:
e.g. Public Function GetPrice() As Variant GetPrice = CVErr(xlErrNA) End Function NickHK "kayard" wrote in message ... Hi, i have some VBA code in the custom-made formula Getprice(Date;ProductCode) that fetch data from a db and return either a number or an error (by means of a text explanation) I would like to return #N/A when there is an error and the value otherwise. The problem is that if i write: Getprice = "#N/A" excel puts in the calling cell mere text and in the sheet #N/A isn't considered as a real NOT AVAILABLE ... Therefore if I sum that cell with another containing a number it doesn't show #N/A but simply avoid considering the cell containing #N/A in the calculation of the sum ... Thanks in advance for your help Sorry for my bad english Paolo Italy -- kayard ------------------------------------------------------------------------ kayard's Profile: http://www.excelforum.com/member.php...o&userid=24716 View this thread: http://www.excelforum.com/showthread...hreadid=569327 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
if formula return | Excel Discussion (Misc queries) | |||
No return for formula | Excel Worksheet Functions | |||
Formula to Return Last Non-Zero Value in Row | Excel Worksheet Functions | |||
Why does my formula return zero? | Excel Discussion (Misc queries) | |||
Date formula...help with return on formula | Excel Worksheet Functions |