Paste only quantities above 0, ignoring zero quantities

Victtor

Board Regular
Joined
Jan 4, 2007
Messages
170
Office Version
  1. 365
Platform
  1. Windows
I hope this makes sense, I do not know how to post a spreadsheet

Column C = Product ID
Column D = Product Description
Column F = on Hand
Column G = Par Level
Column H = Amount to order

What I need is when Column H is a value greater than 0, I need the Product ID (C) and the amount to order (H) copied to sheet named Export. I just need the values, not the formulas.

Example:
In column C, I have these product IDs
101490
101167
100178
73576
100681
30002
30004
51836
101219
51835

In Column H, I have these values to be ordered
1
0
0
0
0
0
0
0
7
14


What should appear on the export sheet (starting in Cell A1)
101490
101219
51835

And starting in cell B1
1
7
14
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Original sheet name omitted, I'm assuming Sheet1, change as required

in Export!A1
=IFERROR(INDEX(Sheet1!$C$1:$C$10,AGGREGATE(15,6,ROW($C$1:$C$10)/((Sheet1!$H$1:$H$10>0)),ROWS(A$1:A1))-(1-1),1),"")
in Export!B1
=IFERROR(INDEX(Sheet1!$H$1:$H$10,AGGREGATE(15,6,ROW($C$1:$C$10)/((Sheet1!$H$1:$H$10>0)),ROWS(A$1:A1))-(1-1),1),"")
copy down for as many rows as you have in Sheet1 Column A
 
Last edited:
Upvote 0
Original sheet name omitted, I'm assuming Sheet1, change as required

in Export!A1
=IFERROR(INDEX(Sheet1!$C$1:$C$10,AGGREGATE(15,6,ROW($C$1:$C$10)/((Sheet1!$H$1:$H$10>0)),ROWS(A$1:A1))-(1-1),1),"")
in Export!B1
=IFERROR(INDEX(Sheet1!$H$1:$H$10,AGGREGATE(15,6,ROW($C$1:$C$10)/((Sheet1!$H$1:$H$10>0)),ROWS(A$1:A1))-(1-1),1),"")
copy down for as many rows as you have in Sheet1 Column A

Ok, I changed the formula as follows to incorporate all my rows:

=IFERROR(INDEX(Source!$C$2:$C$187,AGGREGATE(15,6,ROW($C$2:$C$187)/((Source!$H$2:$H$187>0)),ROWS(A$1:A1))-(1-1),1),"")

=IFERROR(INDEX(Source!$H$2:$H$187,AGGREGATE(15,6,ROW($C$2:$C$187)/((Source!$H$2:$H$187>0)),ROWS(A$1:A1))-(1-1),1),"")


However, something is not working. There are several lines where the PRODUCT ID(C) shows up but the AMOUNT TO ORDER(H) does not. Also there are lines where the PRODUCT ID(C) and the AMOUNT TO ORDER(H) does not show up at all.


The very first item with a quantity does not show up. On the source sheet, cell h3 contains the quantity 1, but the product id 100463 does not appear.
However, the product id on c3 shows up with a 0 quantity (the quantity on that item should be 0 but it should not show up on the export sheet)
 
Upvote 0
This formula assumes the data starts on row 1 (no information supplied to say otherwise)
Needs to be

=IFERROR(INDEX(Source!$c$2:$c$187,AGGREGATE(15,6,ROW($c$2:$c$187)/((Source!$h$2:$h$187>0)),ROWS(A$2:A2))-(2-1),1),"")

Not sure about amount think it should just be

=IFERROR(INDEX(Source!$h$2:$h$187,AGGREGATE(15,6,ROW($c$2:$c$187)/((Source!$h$2:$h$187>0)),ROWS(A$2:A2))-(2-1),1),"")

Maybe supply some example data?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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