+ Reply to Thread
Results 1 to 9 of 9

Catch Array Formula in a variable

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Catch Array Formula in a variable

    This is the formula :
    Please Login or Register  to view this content.
    Question now is how will I catch the result of this formula into a variable to use in a macro.

    example:

    A = 'outcome of above formula'

    Please Login or Register  to view this content.
    ps: I'm assuming I can make the endrow of column X variable in VBA. So the solution would also need to work if lets say X4922 would be ":X" & lrow.

  2. #2
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Catch Array Formula in a variable

    https://www.excelforum.com/excel-pro...ml#post4752924

    You can store it as a defined name..see attached explanation

    Please Login or Register  to view this content.
    to store

    Please Login or Register  to view this content.
    to use
    Last edited by nigelog; 10-19-2017 at 08:49 AM.

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Catch Array Formula in a variable

    try untested
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Catch Array Formula in a variable

    Hi nigelog,
    Thanks but when I paste :
    Please Login or Register  to view this content.
    into the editor I'm getting the 'Compile Error' 'Expected Expression' error.

    You had an Application.worksheet funtion which is probably different from an array formula which this SUM/FREQUENCY formula is.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Catch Array Formula in a variable

    Hi,

    You would need something like
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Catch Array Formula in a variable

    Ok, but this alone will not do it correct?

    Because trying your solution nitwit gives and error too if i do msgbox A (because A - error2902)

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Catch Array Formula in a variable

    It works here, assuming you don't have error values in that range (since that will produce an error as the result of the formula).

  8. #8
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Catch Array Formula in a variable

    You are correct, my bad!

    Thank you very much!

  9. #9
    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,780

    Re: Catch Array Formula in a variable

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. 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.

+ 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. Can I make the row lookup array/range part in an array formula variable?
    By OLLY-7 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-18-2014, 09:06 AM
  2. [SOLVED] Formula Array with a variable range
    By KParkerTX in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2013, 04:25 PM
  3. help with fisheries catch formula
    By Joel Metcalfe in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-29-2012, 02:31 AM
  4. [SOLVED] How to catch the ID in a variable?
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-20-2012, 11:53 AM
  5. Variable OR in an array or similar formula
    By BRISBANEBOB in forum Excel General
    Replies: 4
    Last Post: 01-07-2009, 09:13 PM
  6. Array formula with variable condition
    By BRISBANEBOB in forum Excel General
    Replies: 9
    Last Post: 01-07-2009, 05:33 PM
  7. use a variable array in a formula
    By JPderose in forum Excel General
    Replies: 1
    Last Post: 10-20-2005, 02:05 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