+ Reply to Thread
Results 1 to 11 of 11

Select range / An easier way to implement formula over different ranges

  1. #1
    Registered User
    Join Date
    10-30-2020
    Location
    Nomadic
    MS-Off Ver
    MS 365 (latest), Windows 11
    Posts
    7

    Select range / An easier way to implement formula over different ranges

    This probably isn't possible but it would be great if it was, so please let me know.

    You know how when you select a range of numerical cells, automatic calculations appear such as sum, average and count?

    It would be really helpful if I could create a custom formula that did this.

    For example, let's say we have a long range of daily stock returns. I can get the compound return from any two points by using this formula:

    =product(index(A60:A100+1,0))-1

    And I can get the average daily return using this formula:

    =product(index(A60:A100+1,0))^(1/count(A60:A100))-1

    It would be great to be able to quickly look at different returns between any two dates without the need to redo the formula every time.

    Any solution?

    Thank you
    Attached Files Attached Files
    Last edited by syma1712; 10-10-2022 at 12:06 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Select range / An easier way to implement formula over different ranges

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Administrative Note:

    Is you forum profile showing the version of Excel that you need this to work for?

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    Thanks.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    10-30-2020
    Location
    Nomadic
    MS-Off Ver
    MS 365 (latest), Windows 11
    Posts
    7

    Re: Select range / An easier way to implement formula over different ranges

    I added an example. Thank you.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Select range / An easier way to implement formula over different ranges

    I see no dates...
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    10-30-2020
    Location
    Nomadic
    MS-Off Ver
    MS 365 (latest), Windows 11
    Posts
    7
    Quote Originally Posted by Glenn Kennedy View Post
    I see no dates...
    If there were dates, would it allow me to do what I proposed in the question?

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Select range / An easier way to implement formula over different ranges

    You said:

    "And I can get the average daily return using this formula:

    =product(index(A60:A100+1,0))^(1/count(A60:A100))-1

    It would be great to be able to quickly look at different returns between any two dates without the need to redo the formula every time."

    Since there were no dates in your sheet, knowing what you want isn't at all clear...

  7. #7
    Registered User
    Join Date
    10-30-2020
    Location
    Nomadic
    MS-Off Ver
    MS 365 (latest), Windows 11
    Posts
    7

    Re: Select range / An easier way to implement formula over different ranges

    The problem may be that I gave too much information in my original post, but I was obligated to mention an example and include a worksheet.

    It's really a yes or no question. I will try to rephrase.

    Is there a way to create a custom formula that calculates automatically when you select a range, just like what happens already with sum, average and count at the bottom of any Excel sheet when multiple numerical cells are selected?

    (Yes/No/Kind of?)
    Last edited by syma1712; 10-11-2022 at 06:16 AM.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Select range / An easier way to implement formula over different ranges

    I suspect I'm way off the mark from what you want.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: Select range / An easier way to implement formula over different ranges

    Only with VBA in a message box with the result of formula but i can't help you more with this.
    Diana Tanase


    If the solutions offered helped you to solve your problem, then mark the thread as SOLVED (thread tools in the top menu) and you can click on * to add reputation to those who helped you, as a way to say thank you !

  10. #10
    Registered User
    Join Date
    10-30-2020
    Location
    Nomadic
    MS-Off Ver
    MS 365 (latest), Windows 11
    Posts
    7
    Quote Originally Posted by tanasedn View Post
    Only with VBA in a message box with the result of formula but i can't help you more with this.
    Thank you!

  11. #11
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Select range / An easier way to implement formula over different ranges

    I don't think you can customise the status bar at the bottom to the extent you are talking about but I took Glenn's spreadsheet above and added a macro.

    Simply select the range of data you want in column A and press the button. If this works the message box can be tidied up later, I just wanted to check this is OK.

    The arithmetic seems to work based on the formula's already provided.
    Attached Files Attached Files
    Happy with my advice? Click on the * reputation button below

+ 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. Google Sheets - I need help in highlighting cells and getting sum of highlighted cells
    By eyah002 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 12-19-2020, 08:48 AM
  2. Replies: 0
    Last Post: 12-19-2020, 08:48 AM
  3. Replies: 0
    Last Post: 12-19-2020, 08:48 AM
  4. Macro to select X number of cells below highlighted cells
    By Ptansley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2019, 04:08 AM
  5. Replies: 3
    Last Post: 12-09-2015, 02:05 PM
  6. Nested Loop inside pivot to highlight Cells, But Cells don't stay highlighted!
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-17-2014, 05:00 PM
  7. Highlight cells for data entry but print workbook with no highlighted cells
    By kheino1111 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2014, 06:51 AM

Tags for this Thread

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