+ Reply to Thread
Results 1 to 11 of 11

I need help converting formula array to VBA

  1. #1
    Registered User
    Join Date
    09-07-2016
    Location
    USA
    MS-Off Ver
    2010
    Posts
    5

    Question I need help converting formula array to VBA

    I have the below formula array that I need to put into VBA so it can be ran with a button. I need this to start in cell B2 and go down the column until it reaches blanks and stop. From other help, I have realized that I can get it into a string, but the constant $A2 will not change per cell. I need it to change from A2, B2, C2 etc... until the next cell is blank.

    Please Login or Register  to view this content.
    Any and all help is greatly appreciated!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I need help converting formula array to VBA

    Hello and welcome to the forum.

    Would you clarify -" I need this to start in cell B2 and go down the column until it reaches blanks and stop."
    Are there already values in column B and you want to change them to the formula you mention, or is column B blank at the moment and you want to use another column to find the last row.

    And did you really mean you want the reference to $A2 to change to B2, C2, D2..etc as you copy the formula down to B3, B4, B5... or should it change to $A3, $A4, $A5
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    09-07-2016
    Location
    USA
    MS-Off Ver
    2010
    Posts
    5

    Re: I need help converting formula array to VBA

    Quote Originally Posted by Richard Buttrey View Post
    Hello and welcome to the forum.

    Would you clarify -" I need this to start in cell B2 and go down the column until it reaches blanks and stop."
    Are there already values in column B and you want to change them to the formula you mention, or is column B blank at the moment and you want to use another column to find the last row.

    And did you really mean you want the reference to $A2 to change to B2, C2, D2..etc as you copy the formula down to B3, B4, B5... or should it change to $A3, $A4, $A5
    So I want the output of the formula to start in cell B2. It should correspond with cell A2. So where we are matching A2 with the formula, we output the results to B2. Then move on to match A3, and ouput results to B3. so on so forth. Does that make more sense?

    Cells in column B are blank, you are correct.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I need help converting formula array to VBA

    Hi,

    No, still confused. Would you upload an example that shows the data you start with, then manually add the results you expect from the formula and clearly identify which cells are original data and which are results.

  5. #5
    Registered User
    Join Date
    09-07-2016
    Location
    USA
    MS-Off Ver
    2010
    Posts
    5

    Re: I need help converting formula array to VBA

    Ok. I uploaded to the below link. Hopefully the instructions there make more sense.

    The original data would be in A1:B4 and A8:A11. The formula needs to populate and run starting in cell B9 and go down column B.

    https://app.box.com/s/6iymrzy2evkj9dxqg1uqio8uvrbnfopo

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I need help converting formula array to VBA

    Hi,

    Would you mind uploading the file to this forum please. Many of us prefer not to visit file hosting sites of unknown provenance.

  7. #7
    Registered User
    Join Date
    09-07-2016
    Location
    USA
    MS-Off Ver
    2010
    Posts
    5

    Re: I need help converting formula array to VBA

    I cannot upload to this forum. When I click the attachment button I just get a blank white line. I've tried Chrome and Edge. Any ideas or thoughts on where I can put it so you can view?

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I need help converting formula array to VBA

    Hi,

    Not quite sure which attachment button you are referring to. However if you choose the 'Go Advanced' button at the bottom of your post then look underneath the post for the 'Manage Attachments' option you should be able to upload from there.

  9. #9
    Registered User
    Join Date
    09-07-2016
    Location
    USA
    MS-Off Ver
    2010
    Posts
    5

    Re: I need help converting formula array to VBA

    That is where I was going, but it is not working. Below is the code that I have which is working now. However, I have 1 issue. My VBA code below is searching for any value from A2:A within column B on Sheet 2. Right now, it will post the first result. I need to find all instances the value is found and display them. Would prefer to show them from newest to oldest on new lines such as :

    New1
    Old2

    Please Login or Register  to view this content.

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I need help converting formula array to VBA

    Hi,

    You should not be using a looping macro for queries like this. Loops are inherently slow, particularly where each iteration has to interact with the Excel App.
    The fastest way I know of achieving what you want is with an Advanced Data Filter.

  11. #11
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: I need help converting formula array to VBA

    Try this :
    Please Login or Register  to view this content.

+ 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 an array formula
    By rhinofeeder in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-23-2015, 04:09 AM
  2. Converting Array Formula into VBA returns an error
    By HJHamm in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-23-2014, 12:31 PM
  3. Converting Array Formula to Horizontal Population
    By freud1 in forum Excel General
    Replies: 0
    Last Post: 02-07-2013, 08:53 AM
  4. [SOLVED] Converting text array to values in a formula
    By weeble33 in forum Excel General
    Replies: 4
    Last Post: 07-17-2012, 01:34 PM
  5. Converting array formula to be compatible with 97-2003
    By chichapher in forum Excel General
    Replies: 2
    Last Post: 01-16-2012, 03:10 PM
  6. Converting 3x10 array to a 1X30 array to run a Match formula
    By NBVC in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-08-2009, 07:45 AM
  7. Converting weeknumber formula to VBA (array constants)
    By opopanax666 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2008, 06:23 PM

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