आज, सामग्री के बिल के बारे में एक दिलचस्प एक्सेल समस्या। आपके पास बहुत सारे कच्चे माल हैं। प्रत्येक आइटम को कई अलग-अलग शीर्ष-स्तरीय विधानसभाओं में इकट्ठा किया जा सकता है। हाथ पर कच्चे माल के आधार पर, क्या आपके पास एक निश्चित वस्तु के लिए एक ऑर्डर पूरा करने के लिए पर्याप्त है?
वीडियो देखेंा
- टिम पूछता है: प्रत्येक आइटम कितने में बेचने के लिए उपलब्ध है
- जटिल कारक: एक आइटम कई डिब्बों से युक्त होता है
- बिल विधि # 1: INT (Qty Needed / On Hand) के साथ एक सहायक कॉलम जोड़ें
- उत्पाद में प्रत्येक परिवर्तन पर न्यूनतम सहायक के लिए उप-योग जोड़ें
- # 2 व्यू में सबटोटल्स को संक्षिप्त करें
- सभी डेटा का चयन करें। Alt = "" + का उपयोग करें; चुनिंदा दृश्यमान सेल के लिए
- एक नई रेंज में पेस्ट करें
- स्पेस मिन को कुछ भी नहीं बदलने के लिए Ctrl + H
- माइक विधि # 2
- उत्पाद कॉलम को दाईं ओर कॉपी करें और डेटा का उपयोग करें, डुप्लिकेट निकालें
- उत्पादों की विशिष्ट सूची के आगे, MINIFS का उपयोग करें
- ध्यान दें कि MINIFS केवल Office 365 में उपलब्ध है
- बिल विधि # 3: एक नियमित धुरी तालिका विफल हो जाती है क्योंकि इस मामले में परिकलित फ़ील्ड्स काम नहीं करेंगी।
- अपने डेटा में एक सेल का चयन करें और तालिका में बदलने के लिए Ctrl + T दबाएं।
- इसके बजाय, जैसा कि आप पिवट टेबल बना रहे हैं, एड टू डेटा मॉडल के लिए बॉक्स चुनें
- INT का उपयोग कर बेचने के लिए उपलब्ध के लिए एक नया उपाय बनाएँ
- MINX का उपयोग करके सेल के लिए उपलब्ध किट के लिए एक नया उपाय बनाएँ
- वह धुरी तालिका काम करती है!
- माइक विधि # 4 AGGREGATE फ़ंक्शन का उपयोग करें।
- ऐसा लगता है कि आप MIN तर्क का उपयोग करना चाहते हैं, लेकिन SMALL का उपयोग करें क्योंकि यह सरणियाँ संभालता है
- प्रयोग करें
=AGGREGATE(15,6,INT($D$2:$D$141/$C$2:$C$141)/($A$2:$A$141=F2),1)
- AGGREGATE पाँच कार्यों में से एक है जो किसी सरणी को Ctrl + Shift + Enter के बिना तर्क के रूप में स्वीकार कर सकता है
- बिल विधि # 5
- डेटा को एक तालिका में बदलें और पावर क्वेरी - उर्फ गेट एंड ट्रांसफॉर्म का उपयोग करें
- पावर क्वेरी में, OH / Needed की गणना करें
- पूर्णांक में कनवर्ट करने के लिए नंबर.राउंडडाउन फ़ंक्शन का उपयोग करें
- भाग संख्या और न्यूनतम लाभ द्वारा समूहन का उपयोग करें
- बंद करें और लोड करें
- बोनस: यह ताज़ा है!
वीडियो ट्रांसक्रिप्ट
MrExcel: अरे, वापस स्वागत है, यह एक और द्वंद्वयुद्ध एक्सेल पॉडकास्ट का समय है। मैं बिल जेलन हूं, मैं एक्सेल फन से माइक गिरिन द्वारा शामिल होऊंगा। यह हमारा एपिसोड 190 है: कितने किट बेचने के लिए उपलब्ध हैं?
ठीक है, आज का सवाल टिम ने भेजा है। हमारे द्वंद्वयुद्ध एक्सेल वीडियो देखता है, वह एक रिटेलर के लिए काम करता है और हमारी बिक्री टीम को दिखाने के लिए एक स्प्रेडशीट बनाने के लिए कहता है कि हम क्या हैं और हम क्या बेच सकते हैं। सरल लगता है, है ना? लेकिन यहाँ पकड़ है: जो आइटम वे बेचते हैं उसमें कई डिब्बों होते हैं और प्रति कार्टन आधार पर आविष्कार किया जाता है। यहाँ एक उदाहरण है कि वह क्या देख रहा है। तो यहाँ इस आइटम, P12345 में 3 अलग-अलग चीजें हैं जिन्हें उन्हें जहाज करना है। और किट में, कार्टन 1 के 4, कार्टन 2 के 1, और कार्टन 3 के 1 की आवश्यकता है। और यह स्टॉक में कितने है। ठीक है, इसलिए यहां केवल गणित कर रहे हैं, उनके पास कार्टन 1 के 2 पूर्ण सेट हैं, कार्टन 2 के 4 पूर्ण सेट हैं, और कार्टन 3 के 3 पूर्ण सेट हैं। लेकिन इसका मतलब है कि वे जो बेच सकते हैं वह उन 3 नंबरों में से न्यूनतम है - वे केवल बेच सकते हैं 2. और यहां, उनके पास कार्टन 4 के 4 पूर्ण सेट हैं,कार्टन ५ में से ४, कार्टन ३ के २, कार्टन that's- में से केवल १- वह सीमित वस्तु है। इसलिए, इस मामले में, वे इनमें से केवल एक को बेच सकते हैं। ठीक है। अब, बाद के दिन के लिए एक सवाल, मैंने कहा, "अच्छा, क्या कोई मौका है कि कार्टन 3 का उपयोग एक से अधिक स्थानों पर किया जाए?" और वह कहता है, "हां, लेकिन हम बाद में इस बारे में चिंता करने जा रहे हैं।" ठीक है।
तो यहाँ है कि मैं इस पर हमला करने जा रहा हूँ। मैं वास्तव में इस पर हमला करने के कई अलग-अलग तरीकों के बारे में सोच सकता हूं, इसलिए यह दिलचस्प हो सकता है - यह एक आगे और पीछे का प्रकार हो सकता है। मैं क्या करने जा रहा हूं, मैं चाहता हूं कि यहां एक हेल्पर कॉलम होना चाहिए, और हेल्पर कॉलम एक आइटम-दर-आइटम के आधार पर देखने वाला है कि हम कितने में बेच सकते हैं। तो = 8 ने 4 को विभाजित किया, जैसे कि, और हम इसे कॉपी करने के लिए डबल क्लिक करेंगे। लेकिन, मान लीजिए कि हमें 4 की आवश्यकता है, और हमारे पास 6. ठीक है, इसलिए अब यह 1.5 कहने जा रहा है। ठीक है, तुम नहीं बेच सकते, तुम्हें पता है, आधा सोफे, ठीक है? तो, यह पूरी संख्या होनी चाहिए। तो मैं यहाँ क्या करने जा रहा हूँ, = INT-- INT, पूर्णांक का उपयोग कर रहा है - वह चीज जो दशमलव को हटा देगी और हमें पूरी राशि छोड़ देगी। ठीक है। तो फिर हम 8-- मूल संख्या पर वापस आ गए हैं।
और हमें यह पता लगाने की आवश्यकता है कि यहां प्रत्येक आइटम के लिए, कॉलम ई में सबसे छोटी संख्या क्या है? सुनिश्चित करें कि उत्पाद द्वारा सॉर्ट किए गए डेटा, डेटा टैब पर जाएं, उत्पाद में प्रत्येक परिवर्तन पर, सबटोटल्स चुनें, मिन फ़ंक्शन का उपयोग करें। आप जानते हैं, मैं अपने पावर एक्सेल सेमिनार में हर समय सबटोटल्स सिखाता हूं, और मैं बताता हूं कि यहां 11 कार्य हैं, लेकिन मैंने कभी भी सम और काउंट के अलावा किसी अन्य चीज का उपयोग नहीं किया है। इसलिए जब सबटोटल ऐसा करने का सबसे तेज़ तरीका नहीं हो सकता है, तो मैं यह कहना चाहता हूं कि वास्तव में एक समय था जब मैं सम और काउंट के अलावा किसी अन्य चीज का उपयोग करने में सक्षम था। ठीक है, ठीक क्लिक करें। और हम जो पाने जा रहे हैं, वह है हर बार पर्दा नंबर- उत्पाद संख्या-- परिवर्तन, हमें मिन देखने को मिलता है। और वह मिन वह उत्तर है जो हम चाहते हैं। इसलिए मैं नंबर 2 के दृश्य से नीचे गिर गया, मैं इस डेटा के सभी का चयन करूंगा, और Alt +;सिर्फ दिखाई देने वाली कोशिकाओं का चयन करने के लिए, Ctrl + C, और फिर हम यहां नीचे आएंगे और पेस्ट करेंगे- चलो बस इस क्षेत्र में पेस्ट करें- Ctrl + V। ठीक है। अतिरिक्त कॉलम हटाएं और फिर हमें मिन शब्द से छुटकारा पाना होगा। और न केवल मिन शब्द, बल्कि अंतरिक्ष मिन। ठीक है। इसलिए मैं Ctrl + H का उपयोग करने जा रहा हूं और अंतरिक्ष मिन की पुनरावृत्ति को कुछ भी नहीं बदल रहा हूं, सभी को बदलें, ठीक पर क्लिक करें, बंद करें पर क्लिक करें, और हमारे पास वह टेबल है जो हमारे पास बेचने के लिए उपलब्ध है। ठीक है, माइक, मैं इसे तुम्हारे ऊपर फेंक दूँगा।और जो कुछ हमारे पास उपलब्ध है, उसे बेचने की हमारी तालिका है। ठीक है, माइक, मैं इसे तुम्हारे ऊपर फेंक दूँगा।और जो कुछ हमारे पास उपलब्ध है, उसे बेचने की हमारी तालिका है। ठीक है, माइक, मैं इसे तुम्हारे ऊपर फेंक दूँगा।
माइक: वाह! MrExcel, मुझे यह पसंद है। सबटोटल्स में न्यूनतम कार्य। कितना मजेदार था वो? ठीक है, मैं यहीं इस पत्रक पर जा रहा हूं, मैं उसी हेल्पर कॉलम को करने जा रहा हूं। = INT हम "आवश्यक मात्रा", करीबी कोष्ठकों द्वारा विभाजित "ऑन हैंड" लेंगे। Ctrl + Enter, डबल-क्लिक करें, और इसे नीचे भेजें। अब, मुझे बस किसी दिए गए शर्त या मापदंड के लिए उपलब्ध मिन को खोजने की आवश्यकता है। मैं कॉपी करने के लिए Product, Ctrl + Shift + Down Arroe, Ctrl + C का चयन करने जा रहा हूं, फिर मैं राइट एरो, Ctrl + V पर जा रहा हूं, फिर मैं आने वाला हूं और Remove डुप्लिकेट बोलूंगा। वहाँ है।
मैं हर समय केवल एडवांस फिल्टर, यूनिक रिकॉर्ड्स का उपयोग करता था, लेकिन ऐसा लगता है कि यह तरीका और तेज है। वहाँ मेरी अनूठी सूची है। अब मैं यहां आने वाला हूं। कितने? और मैं नए फ़ंक्शन, MINIFS का उपयोग करने जा रहा हूं। अब, कार्यालय 365 में MINIFS है; Excel 2016 या उसके बाद के लिए, MINRANGE। खैर, मुझे इस कॉलम में न्यूनतम मूल्य, Ctrl + Shift + डाउन एरो, F4, अल्पविराम और मानदंड श्रेणी खोजने की आवश्यकता है - जो कि यह संपूर्ण उत्पाद होने जा रहा है। Ctrl + Shift + डाउन एरो, F4, कॉमा, लेफ्ट एरो और वहां हम जाते हैं। शर्त या मापदंड के आधार पर, कितने कोष्ठक, Ctrl + Enter, डबल-क्लिक करें और उसे नीचे भेजें, से न्यूनतम मूल्य मिलेगा। ठीक है। तो मिनिफ्स और सबटोटल है। मैं इसे आपको वापस फेंकने जा रहा हूं।
MrExcel: Yes, Mike, very nice. Remove Duplicates, get the unique list of products, and then the MINIFS function. I asked him what version of Excel he's on, he said Excel 2016. I hope it's Office 365 version of 2016, so he has access to that. Well, how about a Pivot Table? Alright, so I created a Pivot Table with Product, and Requires, Sum of Required Quantities, and Sum of On Hand. Then from right here, "Analyze", "Fields, Items & Sets", "Calculated Field", and created a new calculated field called "Available", which is On Hand divided by Required Quantity-- that way I don't need the Helper Column over here. And at first it seemed like it was going to work because we had 2, 3, and 4 and the reporting that the minimum is 2-- I changed this calculation, of course, to Min, and that seemed good.
But then, on this one, where we have 2,4,4,1,2, it's reporting 3. And what's happening is it's doing the calculation on this row. We have 25 on hand, divided by 8, that's 3 and a fraction, and so it's reporting 3, and so, no. A regular Pivot Table calculate item is not going to work. But instead, convert this data to a table and then Insert, PivotTable, Add this data to the Data Model, click OK. And we're going to have, down the left-hand side, Product and what it Requires. I'm going to create two implicit measures here with a Required Quantity and some of On Hand, and then I'm going to create a new measure. So, PowerPivot, Measure, a New Measure, and this new measure will be called Available to Sell (AvailToSell) and that formula is going to be, how many we have on hand divided by how many are required for each item, and click OK. Alright, so 8 divided by 4 is 2.
Alright. Now, that's still not our right answer, and we probably need to run this through the Integer function. So, Measures, Manage Measures, edit this and wrap the whole thing inside the INT function like this, click OK, and click Close. Now we're getting a fractional number-- still the wrong answer here.
But we're going to use a great new function that's only available in DAX. New Measure, and this is going to be called KitAvailable, and the function is not MIN, but MINX-- MINX. The MINX function. And the table that we're going to use is Table 1, and then expression is going to be that Available to Sell that we just calculated, and what this does-- the MINX function evaluates on a row by row basis and finds the minimum error. And so, we'll click KitAvailable, OK. Well, check this out: So here, where we have 2, 4, 4, 1, and 2, it's reporting 1. Alright, now in a perfect world all we have is Product and KitAvailable-- we don't need any of this other stuff in the middle. Alright. So we're just going to check this here, 2, 1, 3, 2, are our answers. I'll take the Requires out, 2, 1, 3, 2, yes. It's going to work. We actually take all the intermediate calculations out, just have a KitAvailable, like that. Mike, do you have another one?
Mike: How cool is that,? You use the MINX function in DAX; well, I'm going to go back over here, I'm going to use a formula. But I'm going to pretend like I don't even have this Helper column. I used MINIFS. Well, before MINIFS, in Excel 2016 there was the AGGREGATE function in Excel 2010. Now I want to use MIN, but of course, functions 1 to 13 do not let you do array formulas. So I'm going to have to use SMALL 1 as a substitute for the MIN function. And SMALL is one of the functions, 14 and above, that can handle array operations. That argument right there, array. So function number 15, comma, I want to ignore divided by zero error, so I'm going to type a 6 to ignore errors, comma, and I need to simulate that whole Helper column in the array argument-- INT. And instead of simply saying On Hand divided by Require, we do the whole column, Ctrl+Shift+Down Arrow, F4, divided by the Required column-- Ctrl+Shift+Down Arrow, F4-- now close parenthesis. That INT right there, if I highlight this and hit F9, it simulates that entire How Many Helper column. Ctrl+Z, now I simply divide it by, in parentheses, I need to get an array of TRUES and FALSEs, so I click on Product, Ctrl+Shift+Down Arrow, F4, and I ask the question are any of you equal to that Product ID, close parentheses. That will give me a bunch of TRUES and FALSEs. F9 TRUES and FALSEs in the denominator, TRUE will become a 1, FALSE will become a 0, which will give us divide by zero error. Ctrl+Z.
In essence, if I click the whole array in here, F9, the divide by zero is going to be our filter, so we only see the numbers for a particular Product. Ctrl+Z, and then, of course, AGGREGATE will pick the min out from that array of errors and numbers, close parenthesis. And AGGREGATE's amazing-- one of five functions that has an argument that can handle array operations without Ctrl+Shift+Enter. So I simply Ctrl+Enter and F2. What did I forget? Backspace. Array, then I type a comma and the K is 1 because I always want SMALL 1, which is the min, close parentheses. Ctrl+Enter, double-click, and send it down, F2. Alright. Aggregate with that whole Helper column right there to get how many for each Product. Alright? I'm going to throw it back over to.
MrExcel: Hey, that's beautiful. I knew there'd be a lot of different ways to solve this. I did not think of using AGGREGATE, which of course is better, because if someone has 2010, this will work. The 15 allows an array out here that is gorgeous. Alright, now, hey, when I set up the question, I just missed this and, you know, and Mike, you know this, when people send us questions, they try and minimize the situation to make it sound like it's easy, but the thing that's going to be a disaster here, is the fact that Carton 3 is used in multiple places, alright? And as soon as they sell something from, let's say, they sell, like, this item P12346, well then the number of Carton 3s on hand is going to change, right? And so that's going to impossibly impact what else we can sell.
Alright. So, thinking about how Tim is going to have to manage this process, he's going to have to have a way to regenerate this item quickly. And so, hopefully, he has an inventory table for every item. It'll show how many there are on hand and then, a VLOOKUP here, to pull the inventory over. Alright? That's what I'm hoping is going to happen, because then it might become somewhat manageable. And if this is something we have to reproduce again and again and again, then Power Query definitely has a use here.
So, Power Query in Excel 2010 or 2013, you're going to go download it, you'll have your own Power Query tab; but in Excel 2016, you're going to look for the Get and Transform. It's funny, in Excel 2016, it was the second group, but then in Office 365 they moved it to be the first group. Power Query has the ability to take something from a Table or Range, so I'm going to choose one cell in this table, Ctrl+T-- that will create a table for me. Table 3 is a fine name, I don't need to rename that. Now, this is the Table, we go to Data, From Table or Range, and we are going to Add a new Column-- this column is going to be a Custom Column, it's going to be called "Available", and that is going to be the On Hand divided by Required Quantity. Alright. Now, we need to send this into the INT function. Unfortunately, the function and Power Query are not the same. So, click here and then go to Formula Types, and you'll find this function is called Number.RoundDown, and this is case sensitive-- you have to make sure to use that exact same case. So =Number.RoundDown, open paren, and closed paren, and click OK. And so 11 divided by 4 is 2.75, rounds down to 2. Alright. That's the answer we need there, we don't need these columns anymore. So I can click on Requires, Shift+click on On Hand, and remove those columns. Alright. Now, choose Product, Transform, Group By, we're going to group by the Product, and the new function is going to be called KitsAvailable, and the operation is going to be the min of the available column. Click OK. Alright.
So now we have Product and KitsAvailable. Home, Close & Load, get a brand new sheet with our answers, but here's the beautiful thing. Alright, so, when we sell something-- let's make these columns less wide-- and we sell, let's say we sell enough so we have no Carton 3s left, I change that number there, the VLOOKUPS bring the results, and then come back here and choose this and Refresh all. And you see that now we have none of this, and this, and this, available to sell, because they all needed that Carton 3, and we have none of those left. Being able to Refresh in Power Query is going to help this in the end.
Well, this was a fun one for me because I knew there would be a lot of different ways to solve this problem. The Episode wrap up of this really long Episode: How many of each item is available to sell? And there's multiple cartons, alright? So, the first thing I did was add a Helper column; and then use Subtotals with the Min function; and then a whole bunch of really boring steps. Make had method number two, used MINIFS, which is great if you have Office 365. I went back to a Pivot Table, but a regular Pivot Table won't work, instead had to do a Data Model and then use the MINX function-- the MINX function-- and that calculated field or measure will actually work. Mike, using the AGGREGATE function, beautiful function, one of five functions that can accept an array as an argument without Ctrl+Shift+Enter. And then, method 5, convert the data to a table and use Power Query, also known as Get & Transform; and we're going to calculate On Hand divided by Needed (Required); and then the Number.RoundDown function to convert to an integer; group by part name, number, and calculate the minimum available; Close & Load; and the bonus, it's refreshable.
ठीक है, हे, मैं आपको रोकने के लिए धन्यवाद देना चाहता हूं, हम आपको अगली बार MrExcel से एक और द्वंद्वयुद्ध एक्सेल पॉडकास्ट के लिए देखेंगे और एक्सेल फन है।
फ़ाइल डाउनलोड करें
यहाँ नमूना फ़ाइल डाउनलोड करें: Duel190.xlsx