Closed Thread
Results 1 to 7 of 7

Converting single formula to VBA to cover output area

  1. #1
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Converting single formula to VBA to cover output area

    Hi,

    I have a sheet called "Consolidated data" in an Excel workbook. The sheet has prefilled information in A7:E698 (which can be extended or shortened downwards/vertically depending on raw data) and F1:CVM6 (which can be extended or shortened across/horizontally depending on raw data).

    I have the following formula in cell F7, which is copied across F7:CVM698, but which needs to cover a larger or smaller area depending on the prefilled information described above:

    =IFERROR(INDEX(INDIRECT("SAP"&"[["&F$6&"]:["&F$6&"]]"),MATCH('Consolidated data'!$B7&'Consolidated data'!F$1&'Consolidated data'!F$2&'Consolidated data'!F$3&'Consolidated data'!F$4&'Consolidated data'!F$5,SAP[[Batch]:[Batch]]&SAP[[Operation short text]:[Operation short text]]&SAP[[Step Text]:[Step Text]]&SAP[[MIP Text]:[MIP Text]]&SAP[[MIP]:[MIP]]&SAP[[Int2]:[Int2]],0)),"")

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I need a VBA version of the formula above, which calculates the results required for the area defined by the abovementioned prefilled information, currently covering F7:CVM698.

    I'd appreciate if anyone could help me with the code.

    Best regards,
    Marbleking
    Last edited by Marbleking; 10-14-2021 at 02:57 PM. Reason: Sample workbook attached

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,373

    Re: Converting single formula to VBA to cover output area

    Given that you are using Office 365, I'd have thought you could use Structured Tables OR the new dynamic functions like SORT, FILTER, UNIQUE.

    Note that you can't use the new functions in a Structured Table.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Converting single formula to VBA to cover output area

    Hi TMS,

    Thanks for the input! I have been using the new dynamic array functions for this, but the calculation time is very long. The SAP table, for which I am using structured references, contains a lot of rows and columns. Therefore I think a VBA based on a single cell formula would be a better way for this.

    Best regards,
    Marbleking

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,373

    Re: Converting single formula to VBA to cover output area

    Please see the yellow banner at the top of the page.

  5. #5
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Converting single formula to VBA to cover output area

    Please see attached workbook with example data. It is the grey area of the sheet "Consolidated data" which I need VBA code for.

    Best regards,
    Marbleking

  6. #6
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Converting single formula to VBA to cover output area

    Hi! Is anybody able to solve this with VBA? Regards, Marbleking

  7. #7
    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,460

    Re: Converting single formula to VBA to cover output area

    Thread closed in favour of new one opened in the CS section: https://www.excelforum.com/commercia...tput-area.html
    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.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Help converting formula to VBA/VBA to single sheet
    By kgall89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2019, 06:37 AM
  2. [SOLVED] Needs help in converting the output formula to compute as if it is a formula (w/attached)
    By vando-kun in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-31-2019, 10:12 PM
  3. [SOLVED] Connecting worksheets (withchemical formula data) to output on one single worksheet
    By Enticing22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-24-2013, 11:24 AM
  4. [SOLVED] Converting cover start and end date to an actual date
    By jonathan.haynes in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2013, 11:27 AM
  5. [SOLVED] Paste variable output (SQL Output) into a single cell.
    By fblaze in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2013, 06:24 AM
  6. Replies: 0
    Last Post: 04-17-2011, 02:29 AM
  7. Replies: 2
    Last Post: 01-13-2006, 06:25 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