+ Reply to Thread
Results 1 to 10 of 10

Correl returning #DIV/0! even with OK columns

  1. #1
    Forum Contributor
    Join Date
    08-06-2012
    Location
    Brighton, UK
    MS-Off Ver
    MS Office 2021 and 2019
    Posts
    112

    Correl returning #DIV/0! even with OK columns

    I am getting the error signal #DIV/0! with some colums even tho the two columns do have data in, are of the same size, and have non-zero StDev - I am using the following formula:

    =IF(OR(MD$2735<10,$KQ$2735<10),"",IF(OR(STDEV(MD$1349:MD$2733)=0,STDEV($KQ$1348:$KQ$2732)=0),"",CORREL(MD$1349:MD$2733,$KQ$1348:$KQ$2732)))

    I'm using this same formula widely across the spreadsheet and it generally works - except in about 1% of usage.

    I had tried including the test for StDev >0 in one OR check, but this gave the same result.

    I'm running Excel 2013 in W8.1.

    I'd appreciate help.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Correl returning #DIV/0! even with OK columns

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    08-06-2012
    Location
    Brighton, UK
    MS-Off Ver
    MS Office 2021 and 2019
    Posts
    112

    Re: Correl returning #DIV/0! even with OK columns

    Thanks for responding. Alas, as my file is 7MB+ it exceeds the limit of the Forum. I fear that if I truncate the workbook it will not be able to show the problem.

  4. #4
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Correl returning #DIV/0! even with OK columns

    Quote Originally Posted by Zarathrustra View Post
    I am getting the error signal #DIV/0! with some colums even tho the two columns do have data in, are of the same size, and have non-zero StDev - I am using the following formula:
    Please Login or Register  to view this content.
    I'm using this same formula widely across the spreadsheet and it generally works - except in about 1% of usage.
    Try the following work-around:
    Please Login or Register  to view this content.
    Without seeing actual data that duplicates the problem, I cannot venture a guess about why CORREL might return a #DIV/0 error.

    However, I would have changed your original formula as follows:
    Please Login or Register  to view this content.
    Theoretically, each STDEV might be infinitesimally non-zero, perhaps due to computer binary arithmetic anomalies, but their product is zero. To demonstrate:

    1. Enter 1E-300 into A1.
    2. Enter =OR(A1=0,A1=0) into A2. It displays FALSE.
    3. Enter =A1*A1 into A3. It displays zero.
    4. Enter =(A3=0) into A4. It displays TRUE.
    Last edited by joeu2004; 02-06-2015 at 12:54 PM. Reason: cosmetic

  5. #5
    Forum Contributor
    Join Date
    08-06-2012
    Location
    Brighton, UK
    MS-Off Ver
    MS Office 2021 and 2019
    Posts
    112

    Re: Correl returning #DIV/0! even with OK columns

    Many thanks Joe for all that.

    Your work-around worked fine, and, for me, that seems more elegant too.

    Your final suggestion came up with the same error message as before.

    Something definitely odd. It could be a bug, tho' doubtful (but I have had one or two in past years). Probably something odd in my workbook - even when I copied it (without the dependent associated sheets - a 30Mb file) it still had the same problems.

    Many thanks

  6. #6
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Correl returning #DIV/0! even with OK columns

    Quote Originally Posted by Zarathrustra View Post
    Your final suggestion came up with the same error message as before.
    I'm intrigued. Just curious: what if you change STDEV to STDEVP?

    (Even though the IFERROR implementation is the better choice.)

    If that does not work, I understand why do not want to provide a 30Mb file, but all we should need are the values in MD$1349:MD$2733 and $KQ$1348:$KQ$2732.

    Can you copy and paste-value (not just paste) them into a new Excel workbook, and attach the new Excel workbook to a posting here?

    First, verify that CORREL duplicates the problem in the new Excel workbook. Sometimes, paste-value alters the binary representation of numbers, and the infinitesimal difference might alter the behavior.

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Correl returning #DIV/0! even with OK columns

    As noted, it is difficult to give specific suggestions without a sample file.

    From the help file for the Correl function https://support.office.com/en-us/art...b-239d7b68ca92
    Quote Originally Posted by MSExcel help
    If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.
    If either Array1 or Array2 is empty, or if s (the standard deviation) of their values equals zero, CORREL returns the #DIV/0! error value.
    You have already stated that the arrays are not blank and that s is not zero. Are you certain the values in the two ranges are actually numbers? These kind of functions tend to ignore "numbers stored as text" (which seems to be a common occurrence). If all of your values are "numbers stored as text", then it will be treated as if the range is empty, and you will get the DIV/0 error.

    Beyond that, without a sample file, all I can suggest is to review these reasons for a DIV/0 error and make sure they don't exist.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  8. #8
    Forum Contributor
    Join Date
    08-06-2012
    Location
    Brighton, UK
    MS-Off Ver
    MS Office 2021 and 2019
    Posts
    112

    Re: Correl returning #DIV/0! even with OK columns

    I hadn't thought of that - a mistype. However, I have now checked whether there was any text in my data cells and got the all clear. So that's that ruled out too.

    Thanks again for all the help and suggestions.

  9. #9
    Registered User
    Join Date
    11-07-2015
    Location
    Inverness, IL
    MS-Off Ver
    Office 365 (Excel for Mac 15.15)
    Posts
    3

    Re: Correl returning #DIV/0! even with OK columns

    Hi all. I hope I can tag on here with similar problem. I have two columns with non-zero and variable numeric contents. I am getting a #DIV/0 error trying to CORREL, even if I just use the following 10 rows:

    excel help.jpg

    Thanks for any and all help.

    David
    Last edited by David Prendergast; 11-07-2015 at 09:41 AM.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Correl returning #DIV/0! even with OK columns

    The forum owner prefers that you start your own thread.

    See forum rule #2:

    http://www.excelforum.com/forum-rule...rum-rules.html
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Educate me on the correl function
    By Butcher1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-17-2014, 04:37 PM
  2. Correl using if/then and indirect
    By Datta Dave in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-09-2013, 03:33 PM
  3. correl function
    By censura in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-18-2007, 05:13 AM
  4. CORREL - IF Command .....
    By [email protected] in forum Excel General
    Replies: 1
    Last Post: 08-20-2006, 03:40 PM
  5. [SOLVED] Does Correl/Rank combo work eg CORREL(cols E & H) where E&H=RANK(.
    By Emmanuel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2005, 11:40 AM

Tags for this Thread

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