Generate List if Conditions Are Met

L

Legacy 323112

Guest
Hi all,
I am trying to do the following with VBA and have had some trouble, would appreciate any ideas;

- I have an array of data in my excel spreadsheet (range("A2:D401").
- In column D2, I am performing a calculation of B2 minus C2. This formula extends for each row until row 401.
- Once calculated, I want to generate a new sheet with a list of only the values in columns A, E and F for only the records that have values in column D that are less than or equal to 150. This is to be looped and so I would like this list, if generated, to be appended to each time.

Please help!
Thanks

Example;

In this example, I would like an output in another spreadsheet of "JOHN" "TYPE-2" "AGE-20", because NUMBER3 for JOHN is <150
However, there should be no output of MARY.


ABCDEF
1NAMENUMBER 1NUMBER 2NUMBER 3TYPEAGE
2JOHN2001288120
3MARY20010190322

<tbody>
</tbody>
 
Last edited by a moderator:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Maybe like this...

Howard

Code:
Sheets("To Re-Fill").Activate
     If Range("A2") <> "" Then
        Range("A:A").Copy
        Sheets("Output").Range("A" & Rows.Count).End(xlUp)(2).PasteSpecial Paste:=xlPasteValues
     End If
 
Upvote 0

Forum statistics

Threads
1,215,340
Messages
6,124,386
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top