Slope equation value when empty cells are included

mvillasana

New Member
Joined
Feb 12, 2025
Messages
4
Office Version
  1. 2019
Platform
  1. Windows
Hello everyone!
I'm pretty new to Microsoft Excel and I'm having issues with mathematical equations applied to manually calculate the slope of a line when some of the Y values are unknown.
Being the data:
XY
5
10
15
303.69
453.47
603.26
902.82
1202.38
screenshot_20250212_145927_chrome-png.122298

The excel calculated slope is -0.01455, which is the same as the described value on the scientific article I'm currently working with, but when I try to calculate it by hand using the above formula, it gives me a different value until I fill the empty cells with some value (i.e. 0, 1 or any other), so the equation works when there aren't blank cells. So, my question is, which value does Microsoft excel implements on empty cells to get the right result? How does it handles empty cells to get the right results? I've tried almost every "m" equation I've found without success. Thank you very much!
 

Attachments

  • Screenshot_20250212_145927_Chrome.png
    Screenshot_20250212_145927_Chrome.png
    80.8 KB · Views: 38

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
How does it handles empty cells to get the right results?
SLOPE ignores blank cells.

when I try to calculate it by hand using the above formula, it gives me a different value until I fill the empty cells with some value (i.e. 0, 1 or any other), so the equation works when there aren't blank cells.
You'd have to show what you've tried.
 
Upvote 0
SLOPE ignores blank cells.


You'd have to show what you've tried.
I've tried calculating the average of Y's dividing by only the number of filled cells (5 instead of 8), multiplying the corresponding X values by zero or 1, calculating the average without taking into account the X values corresponding to the empty Y cells (without 5, 10 and 15), everything gives me a different result than the expected one, so there must be something wrong or different. I've also used the following formulas for the linear regression:

formula.png
(multiplying by the number of cells)

SLOPE-Equation.jpg
(without multiplying by the number of cells)

another.png
By adding all these individual results.

Nothing seems to work. I cannot get the same -0.01455 slope value, the formulas only works when there are not empty cells on Y columns.
 
Upvote 0
Using non-blank cells only.See if you can follow:
Book1
ABCDEFGHIJ
1XYx-xbary-ybarproductNumeratorDenominatorSLOPEFORMULA
25-390.566-22.074-75.935220-0.014546-0.014546
310-240.346-8.304
415-90.136-1.224
5303.6921-0.304-6.384
6453.4751-0.744-37.944
7603.26
8902.82
91202.38
Sheet8
Cell Formulas
RangeFormula
D2:E6D2=A5:A9-AVERAGE(A5:A9)
F2:F6F2=D2#*E2#
G2G2=SUM(F2#)
H2H2=SUM(D2#^2)
I2I2=G2/H2
J2J2=SLOPE(B2:B9,A2:A9)
Dynamic array formulas.
 
Upvote 0
Using non-blank cells only.See if you can follow:
Book1
ABCDEFGHIJ
1XYx-xbary-ybarproductNumeratorDenominatorSLOPEFORMULA
25-390.566-22.074-75.935220-0.014546-0.014546
310-240.346-8.304
415-90.136-1.224
5303.6921-0.304-6.384
6453.4751-0.744-37.944
7603.26
8902.82
91202.38
Sheet8
Cell Formulas
RangeFormula
D2:E6D2=A5:A9-AVERAGE(A5:A9)
F2:F6F2=D2#*E2#
G2G2=SUM(F2#)
H2H2=SUM(D2#^2)
I2I2=G2/H2
J2J2=SLOPE(B2:B9,A2:A9)
Dynamic array formulas.
Sir, thank you VERY much! That's exactly what I was needing. You're the best.
 
Upvote 0

Forum statistics

Threads
1,226,508
Messages
6,191,445
Members
453,658
Latest member
healmo

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