+ Reply to Thread
Results 1 to 3 of 3

Loop through range values, calculate, then output to a new range

  1. #1
    Registered User
    Join Date
    06-26-2018
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    18

    Loop through range values, calculate, then output to a new range

    Hi everyone,

    I have tried a few different ways to do this, and am yet to find a simple solution.

    I have created a mock spreadsheet to represent my problem. My real workbook is 100's of 1000's of rows with more complicated calcs, so hopefully this mock problem represent what I am trying to solve.

    Here is my procedure that I am trying to write in VBA.

    1. Take first value in cell of range1 (A3:A20) and output to C3
    2. Cell C3 well now become an input into excel's Filter function which I will only like to filter Range 2 (E2:K665) on the value of cell C2.
    3. The filtered range based on the value of cell C2 will then allow me to perform a calculation on column R, and the output of this will be in column V (along with corresponding Number which is in column U). The reality is the calculation performed is much more complicated than this, but I have made it much simpler for the sake of this exercise.
    4. Based on my output range in columns U and V I would like to copy and paste (or some much better way??) into column XY (only the cells with values in them).
    5. Repeat this process for each cell in range1 (A3:A20) and keep adding to the bottom of values in XY until the last value in range (A3:A20) is reached.

    Have tried a combination of For loops to and then tried to add in a copy and paste, but no VBA that has done the job....yet.

    Hoping you peopes out there can help me solve a problem that is keeping me up at night.....

    Regards,
    J
    Attached Files Attached Files
    Last edited by Jackson2806; 06-25-2021 at 07:55 AM.

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

    Re: Loop through range values, calculate, then output to a new range

    Try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-26-2018
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    18

    Re: Loop through range values, calculate, then output to a new range

    Hi jindon,

    Running this code made me very happy....Looking forward to scaling this up!

    Kudos to you and thank you for your help

+ 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. using a for loop to step through a range and output values, and consolidating user data
    By ACE engineer in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-04-2021, 09:09 AM
  2. [SOLVED] VBA to loop through cell-defined range and paste table output after each loop.
    By mscott123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2019, 03:41 AM
  3. Replies: 7
    Last Post: 01-31-2019, 01:17 PM
  4. Loop through each folder copy values from range in file1 to named range in file2
    By dafella in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2015, 05:19 PM
  5. Loop formula to search through range to get expected output
    By raj2989 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-17-2014, 09:15 AM
  6. [SOLVED] Can you output a value that is given for a range of values from a table??
    By elliebelly in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-26-2013, 09:31 AM
  7. Loop to find a criteria within range, then output results to individual lines
    By bologne in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-17-2011, 12:30 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