+ Reply to Thread
Results 1 to 4 of 4

?CVErr(xlErrDiv0)

  1. #1
    Forum Contributor
    Join Date
    06-29-2011
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    122

    ?CVErr(xlErrDiv0)

    The following code makes me nervous as I don't know how it works (it does 'seem' to work).

    In Cell U6 in Sheet calculator I wand to replace any Div 0 error with 0 itself.

    Looking for insight on how the bold line below works:

    Also there is only one End If !?

    Please Login or Register  to view this content.
    Last edited by intothewild; 06-09-2014 at 02:17 AM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: ?CVErr(xlErrDiv0)

    Non VBA solution.

    =Iferror(j6/g6,0)

    or

    =if(g6=0,0,j6/g6)
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: ?CVErr(xlErrDiv0)

    A simple formula should do the job but if this a part of a code you could try something like this.
    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,239

    Re: ?CVErr(xlErrDiv0)

    CVErr(xlErrDiv0) returns the actual error value for a division by zero error. You only need one End If because only one of the If clauses spans multiple lines - there are two forms of If clause. The one-liner:
    Please Login or Register  to view this content.
    and the multi-line:
    Please Login or Register  to view this content.
    Does that help?
    Remember what the dormouse said
    Feed your head

  5. #5
    Forum Contributor
    Join Date
    06-29-2011
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    122

    Re: ?CVErr(xlErrDiv0)

    Quote Originally Posted by romperstomper View Post
    CVErr(xlErrDiv0) returns the actual error value for a division by zero error. You only need one End If because only one of the If clauses spans multiple lines - there are two forms of If clause. The one-liner:
    Please Login or Register  to view this content.
    and the multi-line:
    Please Login or Register  to view this content.
    Does that help?
    Yes! Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. CVerr function as workaround for "ondelete"
    By cadas in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-11-2009, 06:55 AM
  2. Type Mismatch with CVErr loop
    By JFamilo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-15-2005, 10:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1