Ignore #N/A in the Correl function

jeffreybrown

Well-known Member
Joined
Jul 28, 2004
Messages
5,152
I have a scatter diagram which I want to allow the user to remove data points from the chartted data.

My Y's are in column B and the X's in column C with a Worksheet_BeforeDoubleClick event on column D. DoubleClick in column D and the values in columns C/D change into #N/A so the values will not plot on the chart.

The formula below will ignore zero's, but can't seem to get it to work with the #N/As. Actually there will never be a zero in the data, only an #N/A that needs to be excluded.

CSE
=CORREL((IF(B2:B13<>0,B2:B13,"")),(IF(C2:C13<>0,C2:C13,"")))
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I have a scatter diagram which I want to allow the user to remove data points from the chartted data.

My Y's are in column B and the X's in column C with a Worksheet_BeforeDoubleClick event on column D. DoubleClick in column D and the values in columns C/D change into #N/A so the values will not plot on the chart.

The formula below will ignore zero's, but can't seem to get it to work with the #N/As. Actually there will never be a zero in the data, only an #N/A that needs to be excluded.

CSE
=CORREL((IF(B2:B13<>0,B2:B13,"")),(IF(C2:C13<>0,C2:C13,"")))
I'm not a "stats" person so I've never had to use the CORREL function...

Seems like ISNUMBER(range) should work to exclude anything that is non-numeric.
 
Upvote 0
You're welcome.

Alternatively, you could eliminate the errors from within the B2:C13 formulas.
 
Upvote 0
@Biff
Thanks for the input...I was able to get this to work based on your input...

CSE
=CORREL((IF(ISNUMBER(B2:B13),B2:B13)),(IF(ISNUMBER(C2:C13),C2:C13)))

@AlphaFrog
Your right, I just tested instead of the #N/A to mask the data point on the chart...blanking the data point out works as well.
 
Upvote 0
@Biff
Thanks for the input...I was able to get this to work based on your input...

CSE
=CORREL((IF(ISNUMBER(B2:B13),B2:B13)),(IF(ISNUMBER(C2:C13),C2:C13)))
If the errors are ALWAYS only the #N/A error then this will also work and is the shortest of all the suggestions:

=CORREL((IF(ISNA(B2:B13),"",B2:B13)),(IF(ISNA(C2:C13),"",C2:C13)))

However, only the ISNUMBER version will exclude empty cells (if any might exist).
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,328
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top