+ Reply to Thread
Results 1 to 7 of 7

Converting formulas into VBA

  1. #1
    Registered User
    Join Date
    02-28-2016
    Location
    Wolverhampton,England
    MS-Off Ver
    2013
    Posts
    6

    Converting formulas into VBA

    Hi, I have the following formula =LINEST(J5:O5,$J$2:$O$2,TRUE,FALSE) in cell P5, how do I convert the formula to VBA, as the formula has to be dragged down to row 288098, and so I think it would be wiser to convert it to VBA to decrease the processing time?

    Note the formula is a simple linear regression, with the "J5:O5" cells consisting of numbers, and the "$J$2:$O$2" consisting of numbers.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Converting formulas into VBA

    Typically speaking, built in formula is faster than VBA (when there isn't multi-layer dependency or other factors are involved).
    As VBA processing is single threaded, formula is faster on quite a few operations.

    For an example fastest method for doing lookup, is on sorted data using double approximate lookup.
    https://analystcave.com/excel-vlooku...l-performance/

    If you want to speed up things, you could use vba to fill the formula and then replace with value, doing 50k rows at a time or so.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    02-28-2016
    Location
    Wolverhampton,England
    MS-Off Ver
    2013
    Posts
    6

    Re: Converting formulas into VBA

    Could you elaborate further on how to use vba to fill the formula and then replace with value? sorry I am a bit clueless when it comes to vba

  4. #4
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Converting formulas into VBA

    Hi,
    May be
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-28-2016
    Location
    Wolverhampton,England
    MS-Off Ver
    2013
    Posts
    6

    Re: Converting formulas into VBA

    Thanks thats really helpful and works!, only problem is I forgot to mention that the formula is an array formula, and so the formula is repeated in column Q

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Converting formulas into VBA

    try
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Converting formulas into VBA



    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    Last edited by mohadin; 08-01-2019 at 09:35 AM.

+ 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. [SOLVED] Converting VLOOKUP and IF Formulas to Array CSE Formulas
    By truk2 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-12-2018, 04:34 AM
  2. VBA for converting formulas to text
    By hk4kim in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2013, 08:24 PM
  3. Converting formulas from .xls to .xlsm
    By Gianni10 in forum Excel General
    Replies: 2
    Last Post: 11-29-2011, 07:02 PM
  4. Converting formulas to integers
    By kandor5 in forum Excel General
    Replies: 5
    Last Post: 12-02-2008, 11:52 PM
  5. Converting 3 formulas into one answer
    By Audiguy82 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-17-2007, 04:41 PM
  6. converting formulas to numbers?
    By Grouge in forum Excel General
    Replies: 3
    Last Post: 08-03-2006, 09:29 AM
  7. [SOLVED] converting text to formulas
    By Scot B in forum Excel General
    Replies: 1
    Last Post: 03-01-2005, 09:06 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