Slope and intercept where range is variable

Dimli

Board Regular
Joined
Oct 15, 2004
Messages
109
I hope that you will be able to help me with this, I'm unable to get the HTML maker past the company firewall so I'll try to describe my problem as simply as I can.

I have two column of data that I have charted.
Column A contains the x axis values from 1 to 100,
Column B contains the vaules for each of these points
Column C contains a block identical data held in column B or #N/A
(C1 to C10 could hold #N/A, then C11 to C50 could hold data then C51 to C100 would hold #N/A)
The start and end rows of the data in Column C is variable.

I am able to establiish the formula for a line on a chart using slope and intercept for column B with

=SLOPE($A$1:$A$100,$B$1:$B$100)*B1+INTERCEPT($A$1:$A$100,$B$1:$B$100)

How do I establish the slope and intercept for column C where the start and end rows is variable?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi Dimli

First a remark. The Slope function takes the Y vales as the first parameter and the X values as the second. You seem to have switched the parameters?

Instead of:

=SLOPE($A$1:$A$100,$B$1:$B$100)

shouldn't it be ?

=SLOPE($B$1:$B$100,$A$1:$A$100)

As to your problem, instead of finding the start and end of the range you could apply the function to the whole range discarding the non-numeric values:

=SLOPE(IF(ISNUMBER($C$1:$C$100),$C$1:$C$100),IF(ISNUMBER($C$1:$C$100),$A$1:$A$100))

confirmed with Ctrl-Shift-Enter

Does this solve your problem?
 
Upvote 0
Brilliant thanks!

I took the same approach with the Intercept function and have got the result that I was after.
 
Upvote 0

Forum statistics

Threads
1,214,956
Messages
6,122,465
Members
449,085
Latest member
ExcelError

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