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.


[TABLE="width: 651"]
<tbody>[TR]
[TD="class: xl65, width: 93"][/TD]
[TD="class: xl65, width: 93"]A[/TD]
[TD="class: xl65, width: 93"]B[/TD]
[TD="class: xl65, width: 93"]C[/TD]
[TD="class: xl65, width: 93"]D[/TD]
[TD="class: xl65, width: 93"]E[/TD]
[TD="class: xl65, width: 93"]F[/TD]
[/TR]
[TR]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]NAME[/TD]
[TD="class: xl65"]NUMBER 1[/TD]
[TD="class: xl65"]NUMBER 2[/TD]
[TD="class: xl65"]NUMBER 3[/TD]
[TD="class: xl65"]TYPE[/TD]
[TD="class: xl65"]AGE[/TD]
[/TR]
[TR]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]JOHN[/TD]
[TD="class: xl65"]200[/TD]
[TD="class: xl65"]12[/TD]
[TD="class: xl65"]88[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]20[/TD]
[/TR]
[TR]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]MARY[/TD]
[TD="class: xl65"]200[/TD]
[TD="class: xl65"]10[/TD]
[TD="class: xl65"]190[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]22[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited by a moderator:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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