Recalculate part quantity based on part level to remove parts used in zero quantity assebly

AndrewTucker

New Member
Joined
Apr 21, 2017
Messages
1
Need to recalculate total part quantity based on :

  • if part quantity is zero, then result qty will be zero (this is simple just an if statement)
  • if part report up to an zero qty part e.g. if part level is "8" and it's preceding part "7" is zero qty; then part with level "8" is also zero in quantity.
  • resetting the part qty if the new part level is less than the zero Qty level

[TABLE="class: grid, width: 410"]
<tbody>[TR]
[TD="align: center"]Part Level
[/TD]
[TD="align: center"]Part Type
[/TD]
[TD="align: center"]Qty
[/TD]
[TD="align: center"]Result
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]Part 1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2
[/TD]
[TD="align: center"]Part 2
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3
[/TD]
[TD="align: center"]Part 3
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD="align: center"]Part 4
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3
[/TD]
[TD="align: center"]Part 5
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD="align: center"]Part 6
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD="align: center"]Part 7
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 8
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 9
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7
[/TD]
[TD="align: center"]Part 10
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD]These report to zero qty part; thus actual shipped qty is zero
[/TD]
[/TR]
[TR]
[TD="align: center"]8
[/TD]
[TD="align: center"]Part 11
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD="align: center"]9
[/TD]
[TD="align: center"]Part 12
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD="align: center"]10
[/TD]
[TD="align: center"]Part 13
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD="align: center"]11
[/TD]
[TD="align: center"]Part 14
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD="align: center"]12
[/TD]
[TD="align: center"]Part 15
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD="align: center"]10
[/TD]
[TD="align: center"]Part 16
[/TD]
[TD="align: center"]2
[/TD]
[TD="align: center"]0
[/TD]
[TD]These should be zero also
[/TD]
[/TR]
[TR]
[TD="align: center"]12
[/TD]
[TD="align: center"]Part 17
[/TD]
[TD="align: center"]3
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD="align: center"]12
[/TD]
[TD="align: center"]Part 21
[/TD]
[TD="align: center"]7
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD="align: center"]12
[/TD]
[TD="align: center"]Part 22
[/TD]
[TD="align: center"]8
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD="align: center"]3
[/TD]
[TD="align: center"]Part 16
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD]Part level resets here
[/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 19
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 20
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2
[/TD]
[TD="align: center"]Part 21
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD="align: center"]Part 22
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 23
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 24
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[TD]Reports to zero qty
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 25
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 26
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[TD]Reports to zero qty
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 27
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 28
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[TD]Reports to zero qty
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 29
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 30
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[TD]Reports to zero qty
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 31
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 32
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 33
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[TD]Reports to zero qty
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 34
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 35
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[TD]Reports to zero qty
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Part 36
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Part 37
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[TD]Reports to zero qty
[/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD="align: center"]Part 38
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD]Part level resets here
[/TD]
[/TR]
</tbody>[/TABLE]

I am using formula in result column (column D): =IF(C2=0,0,IF(AND(A2>A1,D1=0),D1,C2)
But this formula resets the result value if the part level is less than previous row but is greater than the "Zero quantity" part level. e.g. red highlighted line in above table.

Pls help. Thanks a lot in advance.

 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,912
Messages
6,175,341
Members
452,638
Latest member
Oluwabukunmi

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