Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Trapping #VALUE! error

I am using a MID function to extract numbers from a string:
=--MID(A1,1,FIND("/",A1)-1)
If the string does not contain "/", it results in the #VALUE! error.
What code needs to go in front of the formula to trap this and return ""?

Thank you for your replies.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Trapping #VALUE! error

=IF(ISNUMBER(FIND("/",A1)),--MID(A1,1,FIND("/",A1)-1),A1)


--
Regards,

Peo Sjoblom




"RhysPieces" wrote in message
...
I am using a MID function to extract numbers from a string:
=--MID(A1,1,FIND("/",A1)-1)
If the string does not contain "/", it results in the #VALUE! error.
What code needs to go in front of the formula to trap this and return ""?

Thank you for your replies.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default Trapping #VALUE! error

=IF(ISERROR(MID(A1,1,FIND("/",A1)-1)),"")
--
Elisabeth


"RhysPieces" wrote:

I am using a MID function to extract numbers from a string:
=--MID(A1,1,FIND("/",A1)-1)
If the string does not contain "/", it results in the #VALUE! error.
What code needs to go in front of the formula to trap this and return ""?

Thank you for your replies.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Trapping #VALUE! error

Here's one way:

=IF(ISERR(FIND("/",A1)),"",--MID(A1,1,FIND("/",A1)-1))

Or:

=IF(ISERR(FIND("/",A1)),"",--LEFT(A1,FIND("/",A1)-1))

--
Biff
Microsoft Excel MVP


"RhysPieces" wrote in message
...
I am using a MID function to extract numbers from a string:
=--MID(A1,1,FIND("/",A1)-1)
If the string does not contain "/", it results in the #VALUE! error.
What code needs to go in front of the formula to trap this and return ""?

Thank you for your replies.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default Trapping #VALUE! error

Disregard my answer--it won't work--sorry.
--
Elisabeth


"Elisabeth" wrote:

=IF(ISERROR(MID(A1,1,FIND("/",A1)-1)),"")
--
Elisabeth


"RhysPieces" wrote:

I am using a MID function to extract numbers from a string:
=--MID(A1,1,FIND("/",A1)-1)
If the string does not contain "/", it results in the #VALUE! error.
What code needs to go in front of the formula to trap this and return ""?

Thank you for your replies.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Trapping #VALUE! error

The solutions from T. Valko and Peo Sjoblom work equally well. Thanks to both
for prompt replies.

"T. Valko" wrote:

Here's one way:

=IF(ISERR(FIND("/",A1)),"",--MID(A1,1,FIND("/",A1)-1))

Or:

=IF(ISERR(FIND("/",A1)),"",--LEFT(A1,FIND("/",A1)-1))

--
Biff
Microsoft Excel MVP


"RhysPieces" wrote in message
...
I am using a MID function to extract numbers from a string:
=--MID(A1,1,FIND("/",A1)-1)
If the string does not contain "/", it results in the #VALUE! error.
What code needs to go in front of the formula to trap this and return ""?

Thank you for your replies.




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Trapping #VALUE! error

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"RhysPieces" wrote in message
...
The solutions from T. Valko and Peo Sjoblom work equally well. Thanks to
both
for prompt replies.

"T. Valko" wrote:

Here's one way:

=IF(ISERR(FIND("/",A1)),"",--MID(A1,1,FIND("/",A1)-1))

Or:

=IF(ISERR(FIND("/",A1)),"",--LEFT(A1,FIND("/",A1)-1))

--
Biff
Microsoft Excel MVP


"RhysPieces" wrote in message
...
I am using a MID function to extract numbers from a string:
=--MID(A1,1,FIND("/",A1)-1)
If the string does not contain "/", it results in the #VALUE! error.
What code needs to go in front of the formula to trap this and return
""?

Thank you for your replies.






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
trapping charts event PLP Charts and Charting in Excel 2 June 21st 07 01:18 AM
Error Trapping from WSH Tom Chau Excel Discussion (Misc queries) 1 August 25th 06 04:21 AM
Chart Events - Trapping arrow key strokes RLang Charts and Charting in Excel 3 August 14th 06 12:41 AM
error trapping flow23 Excel Discussion (Misc queries) 3 April 13th 06 04:51 PM
trapping for printer problems TAndrew Charts and Charting in Excel 0 December 22nd 05 09:11 PM


All times are GMT +1. The time now is 05:52 AM.

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

About Us

"It's about Microsoft Excel"