+ Reply to Thread
Results 1 to 12 of 12

Using Array formula and relative referencing most efficiently?

  1. #1
    Registered User
    Join Date
    04-29-2024
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    7

    Using Array formula and relative referencing most efficiently?

    I´m building templates that then gets populated with data into tables. As the data quantity can vary plenty based on the occasion I want to have a flexible way to handle manipulation of the data. I could just add plenty of formulas, but it´s better if this adjusts dynamically. Both so no calculations are missed, but also so there are not useless formulas that still needs recalc.

    Column OrderNo gets data from OrderData[OrderNo].

    I want G3 to compare E3 and F3. This is all good.
    But then I want G4 to compare G4 and F4. Current formula does not make that happen.

    What is the most efficient way to handle this?

    Screenshot 2024-04-29 at 10.18.06.png


    SAMPLE FILE
    Sample data.xlsx
    Last edited by Lafsen; 04-29-2024 at 05:54 AM.

  2. #2
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Using Array formula and relative referencing most efficiently?

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: 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. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    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.

  3. #3
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Using Array formula and relative referencing most efficiently?

    But then I want G4 to compare G4 and F4. Current formula does not make that happen.
    Simple answer: you can't, as it will produce a circular reference error. You will need to find a different approach.

  4. #4
    Registered User
    Join Date
    04-29-2024
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    7
    Quote Originally Posted by AliGW View Post
    Simple answer: you can't, as it will produce a circular reference error. You will need to find a different approach.
    So I need to use a offset? Is that the only reasonable way then of i want to avoid copying down a formula some 1000 rows?

    Thanks

  5. #5
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Using Array formula and relative referencing most efficiently?

    I asked you for a sample workbook - plase provide it and I'll see what might be best.

  6. #6
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Using Array formula and relative referencing most efficiently?

    Ah, I think I get what you mean (assuming that was a typo in post #1).

    Try this:

    =MAP(E4:E12,F4:F12,LAMBDA(e,f,IF(e>f,e,f)))
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    02-06-2013
    Location
    UK
    MS-Off Ver
    365
    Posts
    693

    Re: Using Array formula and relative referencing most efficiently?

    If that's the desired output, an alternative could be also this:

    Please Login or Register  to view this content.

  8. #8
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Using Array formula and relative referencing most efficiently?

    Nice one!

  9. #9
    Registered User
    Join Date
    04-29-2024
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Using Array formula and relative referencing most efficiently?

    Quote Originally Posted by AliGW View Post
    Nice one!
    Big thanks for the help.

    I´ve added a sample excel in the org post. The Map does not fully do the trick. I would like to avoid specifying the area of the formula.

  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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Using Array formula and relative referencing most efficiently?

    You have to specify a range, but it can be longer than you'll ever need like this:

    =MAP(TOCOL(E4:E1000,1),TOCOL(F4:F1000,1),LAMBDA(e,f,IF(e>f,e,f)))
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,877

    Re: Using Array formula and relative referencing most efficiently?

    Another option
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Using Array formula and relative referencing most efficiently?

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

+ 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. Replies: 8
    Last Post: 12-16-2019, 10:28 PM
  2. [SOLVED] VBA Array Formula - Relative Location
    By zmster2033 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2014, 10:45 AM
  3. [SOLVED] VBA Code: copy relative array formula into X rows
    By haven83 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-30-2012, 01:46 AM
  4. Filling Down with an Array Formula - Changing Relative Reference
    By fervorking in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2011, 06:29 PM
  5. SUM Rows in an Array efficiently
    By stufix in forum Excel General
    Replies: 2
    Last Post: 09-03-2006, 02:28 PM
  6. referencing the value of a cell containing an array formula
    By David McRitchie in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-06-2005, 07:05 AM
  7. Relative Indirect Formula Referencing?
    By Damian in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-07-2005, 02:19 AM

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