+ Reply to Thread
Results 1 to 5 of 5

VBA code for filling and a calculating matrix using row and column

  1. #1
    Registered User
    Join Date
    03-10-2021
    Location
    Calgary, Canada
    MS-Off Ver
    Office 365
    Posts
    1

    VBA code for filling and a calculating matrix using row and column

    I want to fill in a matrix using VBA code with the following:
    - Values x and y are two inputs to do a complex calculationIn this example say x=1 and it needs to increase with fixed value Xincrease (say 5) for a certain number of xsteps (say 4) and say y=1 and it needs to increase with fixed value yincrease (say 10) for a certain number of ystep (say 5)
    - I want to upfront define values for x and y, for the increases for x and y and the number of steps (loops) for each x and y in separate cells somewhere else in the worksheet in the worksheet
    Example of table below
    Matrix.JPG


    Now I want to populate the matrix using both the rows and columns as input values to another calculation
    For example: Say I for example I want to Calculate X^2/y^3 (see result in Cell D4)
    This calculation in the example is actually more complex (it runs in a separate worksheet as inputs for x and y) but this was just for illustration purposes

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: VBA code for filling and a calculating matrix using row and column

    Try out this workbook. Formula is in the code and results show up on Sheet2

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by maniacb; 03-10-2021 at 02:31 PM. Reason: correction to code

  3. #3
    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
    48,523

    Re: VBA code for filling and a calculating matrix using row and column

    Another option, since I've been playing around with it:

    Please Login or Register  to view this content.
    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


  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
    48,523

    Re: VBA code for filling and a calculating matrix using row and column

    If you want to convert the formulae to values, then this:

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: VBA code for filling and a calculating matrix using row and column

    For clarity sake, this update lets user use x and y directly in formula

    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. Filling in missing values in a matrix
    By greg6363 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2021, 04:16 AM
  2. [SOLVED] Filling up a matrix with values from another table
    By huangwh88 in forum Excel General
    Replies: 7
    Last Post: 08-22-2016, 12:27 PM
  3. deleted post
    By joemac92 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-10-2015, 12:19 AM
  4. Filling matrix
    By SERRY in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-27-2015, 10:55 AM
  5. Filling matrix depending on conditions
    By sharpxs in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-05-2014, 06:06 AM
  6. [SOLVED] Need help filling in formulas for a pricing matrix
    By FinGhost in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-14-2014, 03:21 AM
  7. [SOLVED] help with filling in a matrix
    By gsighpol in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-07-2012, 03:42 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