+ Reply to Thread
Results 1 to 11 of 11

use address function to indicate range in calculation

Hybrid View

  1. #1
    Registered User
    Join Date
    08-17-2005
    Location
    Netherlands
    Posts
    4

    Unhappy use address function to indicate range in calculation

    I want to use the address function to indicate the range in the calculation of a slope:

    cell A2 contains the value 20

    =ADDRESS(A2,2) returns $B$20
    =ADDRESS(A2,3) returns $C$20

    Cell B20 and C20 are the starting cells for calculating the slope:
    =slope(B20:B25,C20:C25)

    But putting the address function in the slope calculation, like
    =slope(ADDRESS(A2,2):B25,ADDRESS(A2,3):C25) does not work!

    Why can't I combine these functions?
    Is there another (simple) way?


    Mayo

  2. #2
    Registered User
    Join Date
    08-17-2005
    Location
    Netherlands
    Posts
    4

    Solution found

    Thanx to my boyfriend I found the solution myself

    The indirect function should be used, it converts text to a cell or range reference

    My example would become:
    =slope(indirect("B" & A2 & ":B25"),indirect("C" & A2 & ":C25"))

  3. #3
    Tom Ogilvy
    Guest

    Re: use address function to indicate range in calculation

    =slope(Indirect("B"&A2&":B25"),Indirect("C"&A2&":C25"))

    --
    Regards,
    Tom Ogilvy

    "Mayo" <Mayo.22tjgm_1139247602.4734@excelforum-nospam.com> wrote in message
    news:Mayo.22tjgm_1139247602.4734@excelforum-nospam.com...
    >
    > I want to use the address function to indicate the range in the
    > calculation of a slope:
    >
    > cell A2 contains the value 20
    >
    > =ADDRESS(A2,2) returns $B$20
    > =ADDRESS(A2,3) returns $C$20
    >
    > Cell B20 and C20 are the starting cells for calculating the slope:
    > =slope(B20:B25,C20:C25)
    >
    > But putting the address function in the slope calculation, like
    > =slope(ADDRESS(A2,2):B25,ADDRESS(A2,3):C25) does not work!
    >
    > Why can't I combine these functions?
    > Is there another (simple) way?
    >
    >
    > Mayo
    >
    >
    > --
    > Mayo
    > ------------------------------------------------------------------------
    > Mayo's Profile:

    http://www.excelforum.com/member.php...o&userid=26371
    > View this thread: http://www.excelforum.com/showthread...hreadid=508986
    >




  4. #4
    just_jon
    Guest

    Re: use address function to indicate range in calculation

    Try

    =SLOPE(INDIRECT("B"&A2&":B25"),INDIRECT("C"&A2&":C25"))


  5. #5
    Registered User
    Join Date
    11-26-2012
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: use address function to indicate range in calculation

    Hi,

    The formula given by Mayo and others works very well and is just what I needed to know. The one problem I have with it is, when cutting and pasting the formula the first two letter references in speech marks don't change to the corresponding column. Please could you tell me if there is a way round this?

    Cheers

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: use address function to indicate range in calculation

    That initial post was from 19 years ago !!

    Try it this way:

    =SLOPE(INDEX(B:B,A2):B25,INDEX(C:C,A2):C25)

    Hope this helps.

    Pete

  7. #7
    Registered User
    Join Date
    11-26-2012
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: use address function to indicate range in calculation

    Hi,

    Thanks for the rapid reply, I'll give a go.

    Cheers

  8. #8
    Registered User
    Join Date
    11-26-2012
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: use address function to indicate range in calculation

    Hi Pete_UK

    Your suggestion worked a treat.
    Apparently I have hijacked someone else's thread, apologies for the error. I will create my own thread in future

    Cheers

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,266

    Re: use address function to indicate range in calculation

    In future, pleae start your own thread instead of hijacking someone else's (see the Forum Rules).

    Are you still using Excel 2007? If not, then your forum profile needs updating, please.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,266

    Re: use address function to indicate range in calculation

    Thanks. Could you answer my question about your Excel version? I think your profile may need updating.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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