Finding the difference in quantity of matching items from two sheets












0














I have two different sheets in Excel with two columns in each sheet. The first column contains the name of the item and the second column the quantity.



How do I get the difference in the quantities?



The items are unsorted in both the sheets, plus they are not in the same order.










share|improve this question





























    0














    I have two different sheets in Excel with two columns in each sheet. The first column contains the name of the item and the second column the quantity.



    How do I get the difference in the quantities?



    The items are unsorted in both the sheets, plus they are not in the same order.










    share|improve this question



























      0












      0








      0







      I have two different sheets in Excel with two columns in each sheet. The first column contains the name of the item and the second column the quantity.



      How do I get the difference in the quantities?



      The items are unsorted in both the sheets, plus they are not in the same order.










      share|improve this question















      I have two different sheets in Excel with two columns in each sheet. The first column contains the name of the item and the second column the quantity.



      How do I get the difference in the quantities?



      The items are unsorted in both the sheets, plus they are not in the same order.







      microsoft-excel worksheet-function microsoft-excel-2016






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 10 '18 at 7:40









      robinCTS

      4,00841527




      4,00841527










      asked Dec 10 '18 at 6:24









      Zorro

      176




      176






















          2 Answers
          2






          active

          oldest

          votes


















          2














          What you are after is the VLOOKUP() function.



          Set up Sheet2 like this



          Worksheet 2 Screenshot



          and Sheet1 like this



          Worksheet 1 Screenshot



          Enter the following formula in C2 and ctrl-enter/copy-paste/fill-down/auto-fill into the rest of the table's column:



          =ABS(B2-VLOOKUP(A2,Sheet2!$A$1:$B$8,2,FALSE))


          Explanation:



          The VLOOKUP() function works by looking up the value of the first argument in the first column of the range specified in the second argument, and returns the value from the same row in the column specified by the third argument. (The third argument is a one-based column index of the columns of the range of the second argument.)



          The ABS() function is just there to make all the differences positive. It can be omitted if you also need to know if the quantity in Sheet2 in more or less than that in Sheet1.



          The #N/A error results when the item in Sheet1 doesn't have a corresponding entry in Sheet2. If required, this can be changed to any string by using the IFERROR() function.






          share|improve this answer































            -1














            enter image description here



            How it works:





            1. Write this in Cell G3 of Sheet 2 & fill it down.



                =IFERROR(VLOOKUP(Sheet1!A3,$A$3:$B$9,2,False)-Sheet1!B3,"Not Found")


            2. VLOOKUP function finds & match the Items between Sheets and Subtracts Quantity if found, otherwise IFERROR returns the Not Found message.



            Or you may use this one also in Cell H3of Sheet 2 & fill it down.



            =IFERROR(ABS(IF(COUNTIF(A$3:A$9,Sheet1!A3)<>0,Sheet1!B3-INDEX(B$3:B$9,MATCH(Sheet1!A3,A$3:A$9,0))," ")),"Not Found")



            1. In first part of the formula COUNTIF find the match between Items in both Sheets and if returns 1, then the next part of the Formula Subtracts Quantities between Sheets which is supported by INDEX & MATCH combination.


            Adjust Cell references in the Formula as needed.






            share|improve this answer























            • Write your concern why this post has been Down voted ???
              – Rajesh S
              Dec 11 '18 at 8:18











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1382238%2ffinding-the-difference-in-quantity-of-matching-items-from-two-sheets%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            What you are after is the VLOOKUP() function.



            Set up Sheet2 like this



            Worksheet 2 Screenshot



            and Sheet1 like this



            Worksheet 1 Screenshot



            Enter the following formula in C2 and ctrl-enter/copy-paste/fill-down/auto-fill into the rest of the table's column:



            =ABS(B2-VLOOKUP(A2,Sheet2!$A$1:$B$8,2,FALSE))


            Explanation:



            The VLOOKUP() function works by looking up the value of the first argument in the first column of the range specified in the second argument, and returns the value from the same row in the column specified by the third argument. (The third argument is a one-based column index of the columns of the range of the second argument.)



            The ABS() function is just there to make all the differences positive. It can be omitted if you also need to know if the quantity in Sheet2 in more or less than that in Sheet1.



            The #N/A error results when the item in Sheet1 doesn't have a corresponding entry in Sheet2. If required, this can be changed to any string by using the IFERROR() function.






            share|improve this answer




























              2














              What you are after is the VLOOKUP() function.



              Set up Sheet2 like this



              Worksheet 2 Screenshot



              and Sheet1 like this



              Worksheet 1 Screenshot



              Enter the following formula in C2 and ctrl-enter/copy-paste/fill-down/auto-fill into the rest of the table's column:



              =ABS(B2-VLOOKUP(A2,Sheet2!$A$1:$B$8,2,FALSE))


              Explanation:



              The VLOOKUP() function works by looking up the value of the first argument in the first column of the range specified in the second argument, and returns the value from the same row in the column specified by the third argument. (The third argument is a one-based column index of the columns of the range of the second argument.)



              The ABS() function is just there to make all the differences positive. It can be omitted if you also need to know if the quantity in Sheet2 in more or less than that in Sheet1.



              The #N/A error results when the item in Sheet1 doesn't have a corresponding entry in Sheet2. If required, this can be changed to any string by using the IFERROR() function.






              share|improve this answer


























                2












                2








                2






                What you are after is the VLOOKUP() function.



                Set up Sheet2 like this



                Worksheet 2 Screenshot



                and Sheet1 like this



                Worksheet 1 Screenshot



                Enter the following formula in C2 and ctrl-enter/copy-paste/fill-down/auto-fill into the rest of the table's column:



                =ABS(B2-VLOOKUP(A2,Sheet2!$A$1:$B$8,2,FALSE))


                Explanation:



                The VLOOKUP() function works by looking up the value of the first argument in the first column of the range specified in the second argument, and returns the value from the same row in the column specified by the third argument. (The third argument is a one-based column index of the columns of the range of the second argument.)



                The ABS() function is just there to make all the differences positive. It can be omitted if you also need to know if the quantity in Sheet2 in more or less than that in Sheet1.



                The #N/A error results when the item in Sheet1 doesn't have a corresponding entry in Sheet2. If required, this can be changed to any string by using the IFERROR() function.






                share|improve this answer














                What you are after is the VLOOKUP() function.



                Set up Sheet2 like this



                Worksheet 2 Screenshot



                and Sheet1 like this



                Worksheet 1 Screenshot



                Enter the following formula in C2 and ctrl-enter/copy-paste/fill-down/auto-fill into the rest of the table's column:



                =ABS(B2-VLOOKUP(A2,Sheet2!$A$1:$B$8,2,FALSE))


                Explanation:



                The VLOOKUP() function works by looking up the value of the first argument in the first column of the range specified in the second argument, and returns the value from the same row in the column specified by the third argument. (The third argument is a one-based column index of the columns of the range of the second argument.)



                The ABS() function is just there to make all the differences positive. It can be omitted if you also need to know if the quantity in Sheet2 in more or less than that in Sheet1.



                The #N/A error results when the item in Sheet1 doesn't have a corresponding entry in Sheet2. If required, this can be changed to any string by using the IFERROR() function.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 10 '18 at 7:25

























                answered Dec 10 '18 at 7:12









                robinCTS

                4,00841527




                4,00841527

























                    -1














                    enter image description here



                    How it works:





                    1. Write this in Cell G3 of Sheet 2 & fill it down.



                        =IFERROR(VLOOKUP(Sheet1!A3,$A$3:$B$9,2,False)-Sheet1!B3,"Not Found")


                    2. VLOOKUP function finds & match the Items between Sheets and Subtracts Quantity if found, otherwise IFERROR returns the Not Found message.



                    Or you may use this one also in Cell H3of Sheet 2 & fill it down.



                    =IFERROR(ABS(IF(COUNTIF(A$3:A$9,Sheet1!A3)<>0,Sheet1!B3-INDEX(B$3:B$9,MATCH(Sheet1!A3,A$3:A$9,0))," ")),"Not Found")



                    1. In first part of the formula COUNTIF find the match between Items in both Sheets and if returns 1, then the next part of the Formula Subtracts Quantities between Sheets which is supported by INDEX & MATCH combination.


                    Adjust Cell references in the Formula as needed.






                    share|improve this answer























                    • Write your concern why this post has been Down voted ???
                      – Rajesh S
                      Dec 11 '18 at 8:18
















                    -1














                    enter image description here



                    How it works:





                    1. Write this in Cell G3 of Sheet 2 & fill it down.



                        =IFERROR(VLOOKUP(Sheet1!A3,$A$3:$B$9,2,False)-Sheet1!B3,"Not Found")


                    2. VLOOKUP function finds & match the Items between Sheets and Subtracts Quantity if found, otherwise IFERROR returns the Not Found message.



                    Or you may use this one also in Cell H3of Sheet 2 & fill it down.



                    =IFERROR(ABS(IF(COUNTIF(A$3:A$9,Sheet1!A3)<>0,Sheet1!B3-INDEX(B$3:B$9,MATCH(Sheet1!A3,A$3:A$9,0))," ")),"Not Found")



                    1. In first part of the formula COUNTIF find the match between Items in both Sheets and if returns 1, then the next part of the Formula Subtracts Quantities between Sheets which is supported by INDEX & MATCH combination.


                    Adjust Cell references in the Formula as needed.






                    share|improve this answer























                    • Write your concern why this post has been Down voted ???
                      – Rajesh S
                      Dec 11 '18 at 8:18














                    -1












                    -1








                    -1






                    enter image description here



                    How it works:





                    1. Write this in Cell G3 of Sheet 2 & fill it down.



                        =IFERROR(VLOOKUP(Sheet1!A3,$A$3:$B$9,2,False)-Sheet1!B3,"Not Found")


                    2. VLOOKUP function finds & match the Items between Sheets and Subtracts Quantity if found, otherwise IFERROR returns the Not Found message.



                    Or you may use this one also in Cell H3of Sheet 2 & fill it down.



                    =IFERROR(ABS(IF(COUNTIF(A$3:A$9,Sheet1!A3)<>0,Sheet1!B3-INDEX(B$3:B$9,MATCH(Sheet1!A3,A$3:A$9,0))," ")),"Not Found")



                    1. In first part of the formula COUNTIF find the match between Items in both Sheets and if returns 1, then the next part of the Formula Subtracts Quantities between Sheets which is supported by INDEX & MATCH combination.


                    Adjust Cell references in the Formula as needed.






                    share|improve this answer














                    enter image description here



                    How it works:





                    1. Write this in Cell G3 of Sheet 2 & fill it down.



                        =IFERROR(VLOOKUP(Sheet1!A3,$A$3:$B$9,2,False)-Sheet1!B3,"Not Found")


                    2. VLOOKUP function finds & match the Items between Sheets and Subtracts Quantity if found, otherwise IFERROR returns the Not Found message.



                    Or you may use this one also in Cell H3of Sheet 2 & fill it down.



                    =IFERROR(ABS(IF(COUNTIF(A$3:A$9,Sheet1!A3)<>0,Sheet1!B3-INDEX(B$3:B$9,MATCH(Sheet1!A3,A$3:A$9,0))," ")),"Not Found")



                    1. In first part of the formula COUNTIF find the match between Items in both Sheets and if returns 1, then the next part of the Formula Subtracts Quantities between Sheets which is supported by INDEX & MATCH combination.


                    Adjust Cell references in the Formula as needed.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Dec 10 '18 at 9:29

























                    answered Dec 10 '18 at 7:25









                    Rajesh S

                    3,7021522




                    3,7021522












                    • Write your concern why this post has been Down voted ???
                      – Rajesh S
                      Dec 11 '18 at 8:18


















                    • Write your concern why this post has been Down voted ???
                      – Rajesh S
                      Dec 11 '18 at 8:18
















                    Write your concern why this post has been Down voted ???
                    – Rajesh S
                    Dec 11 '18 at 8:18




                    Write your concern why this post has been Down voted ???
                    – Rajesh S
                    Dec 11 '18 at 8:18


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1382238%2ffinding-the-difference-in-quantity-of-matching-items-from-two-sheets%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                    How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...