GET A RESULT BASED ON SPECIFIC Criteria

enitron

New Member
Joined
Mar 21, 2014
Messages
12
Hi.

I am new to this forum and i was wondering if someone could help me out with an excel function i need

So i have a table with the sales per product and the remaining stock. I want a function to calculate the appropriate quantity to be returned to the warehouse.
If the sales are lowered than 2 peices i want to leave as stock t peices and the remaining peices to be returned. If sale are more that 2 pieces i want stock equal to the sales.

Here is an exmple table:

The column: QUANTITY TO BE RETURNED is the desired result using a function.
R163SALESSTOCKQUANTITY TO BE RETURNED
PRODUCT 1231
PRODUCT 2341
PRODUCT 3153
PRODUCT 432
PRODUCT 5231
PRODUCT 6075
PRODUCT 7075
PRODUCT 8164
PRODUCT 9075
PRODUCT 10075
PRODUCT 11164

Thank you in advance for your help. :)
 

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 I hope this helps. The formula i Have used is long but it satisfy the two conditions

When
1. stocks<=2
2. Stock<=sales

The answer can be negative if the outer if condition is removed, this is used just to get zero in place of negative numbers.
Book1
ABCD
1R163SALESSTOCKQUANTITY TO BE RETURNED
2PRODUCT 1231
3PRODUCT 2341
4PRODUCT 3153
5PRODUCT 4320
6PRODUCT 5231
7PRODUCT 6075
8PRODUCT 7075
9PRODUCT 8164
10PRODUCT 9075
11PRODUCT 10075
12PRODUCT 11164
Sheet1
Cell Formulas
RangeFormula
D2:D12D2=IF(IF(B2>=2,C2-B2,C2-2)>0,IF(B2>=2,C2-B2,C2-2),0)
 
Upvote 0
Here is another way.

20 08 20.xlsm
ABCD
1R163SALESSTOCKQUANTITY TO BE RETURNED
2PRODUCT 1231
3PRODUCT 2341
4PRODUCT 3153
5PRODUCT 4320
6PRODUCT 5231
7PRODUCT 6075
8PRODUCT 7075
9PRODUCT 8164
10PRODUCT 9075
11PRODUCT 10075
12PRODUCT 11164
Stock Returned
Cell Formulas
RangeFormula
D2:D12D2=C2-MIN(MAX(B2,2),C2)
 
Upvote 0
Thank you so so much!!!
Both of your answers are working perfectly!!!
Your help is greatly appreciated!!
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,867
Members
449,053
Latest member
Mesh

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