Forum Discussion
Lookup with 3 Criterias and return next available Product Code from another sheet
In this case generally , we need an accounting double entry journal and G/L system to summary balance sheet and income statement if you need to track cash or AR.
Now,you only want cost and profit ,so simplize the joural as below.
I guess it will be easier for further profit/stock in hand calculation if you consolidate inventory and sales journal in one sheet rather than two work sheets.
Because you need calculate stock in hand qty of each batch inventory before you sale out whole or partial of specific in_stock batch goods.
I have checked your formulars which occupy many cells with some complex expressions and may slow down your Excel running when data grows.
If I were you who need check out specific inventory for sale each time, I would query the current stock on hand of sepecif code (e.g. like WT-B) with sql:
select code,sum(qty) from Transaction_Journal where Code like 'WT-B%' group by code;
Then I can insert the journal with proper products Code.
Additional,if too many rows are applied data validations,running slowly will occour.
So it is necessory to setup an input form for data validation and appending new record rather than data validation in many cells.
TransNo Date Code qty memo amount type
| p_01 | 2023/1/1 | WT-B-1 | 100 | purchase | 200 | stock |
| p_02 | 2023/1/5 | WT-B-2 | 20 | purchase | 60 | stock |
| s_01 | 2023/1/7 | WT-B-1 | -100 | sales-cost | -200 | stock,profit |
| s_01 | 2023/1/7 | WT-B-2 | -2 | sales-cost | -6 | stock,profit |
| s_01 | 2023/1/7 | WT-B-1 | sales-income | 400 | profit | |
| s_01 | 2023/1/7 | WT-B-2 | sales-income | 8 | profit | |
| s_02 | 2023/1/8 | WT-B-2 | -2 | sales-cost | -6 | stock,profit |
| s_02 | 2023/1/8 | WT-B-2 | sales-income | 8 | profit |
Code sum(qty)
| WT-B-1 | 0 |
| WT-B-2 | 16 |