+ Reply to Thread
Results 1 to 8 of 8

slope of a line (x coefficient of trend line ) in chart & coordinate

  1. #1
    Forum Contributor
    Join Date
    08-06-2014
    Location
    iran
    MS-Off Ver
    2016
    Posts
    110

    slope of a line (x coefficient of trend line ) in chart & coordinate

    Hi every one

    I want to make sheet like "result" in attached file with columns : xutm , yutm ,and slope of trend line.i found trend line with scatter chart before in every sheets so just need to choose coefficient of x in equation for every coordinate
    so please help me with macro code because i have many sheets

    thank you so much
    Attached Files Attached Files
    Last edited by fakhteh; 05-01-2020 at 01:52 PM.

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: slope of a line (x coefficient of trend line ) in chart & coordinate

    Please try at C2

    =SLOPE(INDIRECT("'"&A2&"'!R2:R19"),INDIRECT("'"&A2&"'!Q2:Q19"))
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-06-2014
    Location
    iran
    MS-Off Ver
    2016
    Posts
    110

    Re: slope of a line (x coefficient of trend line ) in chart & coordinate

    hi
    i ran your formula and faced with error #ref! i do not know why
    what is the role of column A in your formula
    thank you

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: slope of a line (x coefficient of trend line ) in chart & coordinate

    A2 is sheet name of the slope to be pulled.

  5. #5
    Forum Contributor
    Join Date
    08-06-2014
    Location
    iran
    MS-Off Ver
    2016
    Posts
    110

    Re: slope of a line (x coefficient of trend line ) in chart & coordinate

    Hi again
    it works thank you well done
    could you please send me the code or formula to have xutm that equals to sheet name= A2 and then B2 as yutm of the sheet ;so that i have 3 columns
    xutm=A2=Sheet name
    yutm=B2
    slope=c2
    so then i will have result sheet with all coordinate point(x utm-y utm ) with their data line slope
    i hope if i could explain well, forgive me for my weak English language
    thank you very much

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: slope of a line (x coefficient of trend line ) in chart & coordinate

    Press Ctrl+F3
    New Name : SheetName
    =MID(GET.WORKBOOK(1),FIND("]",GET.WORKBOOK(1))+1,9)


    A2
    =IF(ROWS(A$2:A2)< COUNTA(SheetName),INDEX(SheetName,ROWS(A$2:A2)),"")

    B2
    =IF(A2="","",INDIRECT("'"&A2&"'!h2")&"")

    C2
    =IF(B2="","",SLOPE(INDIRECT("'"&A2&"'!R2:R19"),INDIRECT("'"&A2&"'!Q2:Q19")))


    Save as xlsb
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    08-06-2014
    Location
    iran
    MS-Off Ver
    2016
    Posts
    110

    Re: slope of a line (x coefficient of trend line ) in chart & coordinate

    hi
    first of all i appreciate your help
    is it possible to change a bit more
    in part R2:R19 and Q2:Q19
    because it starts from R2 and Q2 but i do not know where it ends maybe i have to put $ (R2:R$ and Q2:Q$)
    I hope i could explain well so forgive me for my weak language

    =IF(B2=""؛""؛SLOPE(INDIRECT("'"&A2&"'!R2:R19")؛INDIRECT("'"&A2&"'!Q2:Q19")))

    thank you so much

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,554

    Re: slope of a line (x coefficient of trend line ) in chart & coordinate

    Please try the following:
    On the 449447 and 452085 sheets paste the following into cell U1: =COUNT(Q:Q)+1
    On the Result sheet paste the following into cell H2 and then copy down: =INDIRECT("'"&A2&"'!u1")
    On the Result sheet paste the following modification of Bo_Ry's formula into cell B2 and then copy down: =IF(B2="","",SLOPE(INDIRECT("'"&A2&"'!R2:R"&H2),INDIRECT("'"&A2&"'!Q2:Q"&H2)))
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. Length and distance from the line coordinate and point coordinate
    By sanju2323 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-02-2019, 03:13 PM
  2. Help with Trend Line on Line Chart
    By mstech918 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-05-2012, 10:57 AM
  3. Bar chart with trend line
    By tani001 in forum Excel General
    Replies: 2
    Last Post: 05-11-2011, 07:04 AM
  4. Obtaining the slope from a chart's trend line
    By eddyq in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 03-19-2010, 10:06 AM
  5. Chart Trend Line
    By mperata in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-31-2009, 03:30 PM
  6. Bar chart with a trend line
    By Russian in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 11-26-2006, 06:42 PM
  7. Slope of a Trend Line
    By jpx in forum Excel General
    Replies: 1
    Last Post: 04-24-2006, 06:10 PM

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