Extraction boxes and pieces from whole QTY into textbox on form

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
675
Office Version
  1. 2019
Hi
I would extract details in label 6 to show me what exactly boxes and pieces .
so when enter QTY in textbox6 then should calculate pieces for each box based on textbox1,textbox2
FRM.PNG

in this case textbox6 contains 22 pieces and compare with pieces in textbox2 and in this case every 10 pieces in textbox2 will be for each box in textbox1 . so in textbox1 every box contains 10 pieces .
in textbox6 will contain 2 boxes and 2 pieces ( 10+10= 20 for two boxes , 2 pieces will be less than 10 pieces for each box so can't
show as boxes.
here is example to show result in label6 after fill textbox6
frms.PNG



should match textbox6 with textbox3 if the QTY in textbox6 bigger than textbox3 and show plus QTY
fer.PNG


ft.PNG


this is less than one box contains (10 pieces) so will show 3 pieces
fvf.PNG


I hope theses pictures are clear.
thanks.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hello,

As far as i understand, let :
ppb : pieces per box (=10)
nbB : boxes needed
pL : Pieces left
pT : total pieces

Euclidean division gives you:

nbB = pT \ ppb
pL = pT Mod ppb

CF: \ Operator - Visual Basic | Microsoft Learn , Mod operator | Microsoft Learn

You just need to retrieve the values from your textboxes, and cast them from text to integers.
Your message would be "OUT: you have nbB boxes and pL pieces"
 
Upvote 0

Forum statistics

Threads
1,226,125
Messages
6,189,120
Members
453,524
Latest member
AshJames

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