+ Reply to Thread
Results 1 to 16 of 16

Comparison of two Columns

  1. #1
    Registered User
    Join Date
    09-05-2016
    Location
    Pakistan
    MS-Off Ver
    2013
    Posts
    14

    Exclamation Comparison of two Columns

    Hi Everyone,

    I am making a database for inventory management. Everyday a certain quantity of material is assigned to different machines and record is kept for each machine. At the end of the day some of the unused material is being reversed to the warehouse.
    I am having difficulty in figuring out to determine the exact material which is used for a certain machine.
    Can you guys tell me which function to be used and how ?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Comparison of two Columns

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-05-2016
    Location
    Pakistan
    MS-Off Ver
    2013
    Posts
    14

    Re: Comparison of two Columns

    Here you go Alan.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Comparison of two Columns

    There are several discrepancies with the 'after' sheet that could be cleared up so that help can be offered.
    1) There are 10 bar codes under Materials issued but only 8 combined under materials used and materials reversed although the equation on the sheet reads "Material Used = Material Issued - Material Reversed"
    2) A bar code that are listed once in materials issued and shows up under materials reversed and materials used (I32F4QW000450087641703038).
    3) Material bar code Q00009600635067501 is issued to machines 1,2 and 4 but listed as used by machine 5.
    4) Material bar code Q00009600635067501 is issued three times and reversed once. How is it determined the machine from which the material was reversed?
    5) The material bar codes listed as issued to machine 5 are neither listed as reversed nor used.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    09-05-2016
    Location
    Pakistan
    MS-Off Ver
    2013
    Posts
    14

    Re: Comparison of two Columns

    Dear Jete,
    This was a sample file just to give you guys an idea what I am trying to do.
    However Debugged file is attached below.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Comparison of two Columns

    The following formula will give the values for column D:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The following formula will give the values for column E:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let me know if you have any questions.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-05-2016
    Location
    Pakistan
    MS-Off Ver
    2013
    Posts
    14

    Re: Comparison of two Columns

    Thanks a lot Jete
    But I need a generic formula for any length of column because the barcodes will be adding day by day and column length will increase accordingly.
    I hope you can help me.

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Comparison of two Columns

    Simplest way that I can think of would be to increase the second row number reference to be that of the last possible row, which for version 2010 is 1048576.
    The formula for column D would then read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The formula for column E would then read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In the attached file I added conditional formatting to column D so that any zeros would have a fount color of white and not be visible.
    Let me know if you have any questions.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-05-2016
    Location
    Pakistan
    MS-Off Ver
    2013
    Posts
    14

    Re: Comparison of two Columns

    Thanks a lot Jete.
    Just one more thing, Can you please explain me both f these codes for my better understanding and future use ?

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Comparison of two Columns

    Looking at the formula that populates column D from the inside and working out, it uses instances where there is no match between the values in column C and the values in column A to create a true/false array. This array is then compared to the row numbers in the sheet, generated by ROW($A:$A), which creates an array of numbers and #DIV0 errors. The second argument of AGGREGATE, 6, ignores the errors and the first argument, 15, finds the nth smallest, as determined by the second ROW function, number in the array. That number is passed to the index which will find the bar code in that row of column A.
    The formula that populates column E is just an index match where the match finds the bar code and returns the row number where it is found and the index finds the associated machine# in column B.
    Looking at the file attached to post #6, which has fewer rows to work with, select D5 and run the Evaluate Formula on the Formula tab to see how this all works.
    As to the solution itself, Your Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools link above your first post. I hope that you have a blessed day.

  11. #11
    Registered User
    Join Date
    09-05-2016
    Location
    Pakistan
    MS-Off Ver
    2013
    Posts
    14

    Re: Comparison of two Columns

    One Last thing Jete.
    A lot of material from same batch has the same barcode number. This means that same barcode is issued to two different machines.
    So If column D has the same barcode twice , Column E only returns the same machine number against the both barcodes.
    I have attached the file for better understanding.

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Comparison of two Columns

    We can clear up the numbering issue by doing the following.
    1) Modify the match argument cell references for the column D formula to absolute as in:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    2) Copy the formula over to column E and, with both D4 and E4 selected, double click to copy down.
    This does re-raise question #4 from post #4, what if a lot of batch H0003819717101400002363 was reversed, how could it be determined from which machine it came?
    Let me know if you have any questions.

  13. #13
    Registered User
    Join Date
    09-05-2016
    Location
    Pakistan
    MS-Off Ver
    2013
    Posts
    14

    Re: Comparison of two Columns

    Yes this do re raise that question - "what if a lot of batch with same barcode was reversed, how could it be determined from which machine it came."
    What if we introduce another column against * Material reversed" which contain the machine number from which material is reversed.
    Can we eliminate that problem ?

    I have attached the file to get the better understanding.

  14. #14
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Comparison of two Columns

    Try pasting the following formula in E4 then copy down and across:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Note: the processor in my laptop ran for a while before the correct values were displayed in columns E and F.
    Let me know if you have any questions.

  15. #15
    Registered User
    Join Date
    09-05-2016
    Location
    Pakistan
    MS-Off Ver
    2013
    Posts
    14

    Smile Re: Comparison of two Columns

    Thanks a lot Jete for contributing this much to my work. Your efforts are highly appreciated and apologies for not replying earlier.

  16. #16
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Comparison of two Columns

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread 'Solved' using the thread tools link above your first post. I hope that you have a blessed day.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 4 Columns Comparison
    By AndrewDps in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-09-2016, 07:45 AM
  2. Columns comparison
    By girish1989 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-27-2013, 12:59 AM
  3. Comparison between 4 columns
    By johnmathew in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-09-2012, 01:59 AM
  4. [SOLVED] 3 Columns / Quote Comparison
    By Keith S. in forum Excel General
    Replies: 3
    Last Post: 05-25-2012, 01:54 AM
  5. Comparison between 1 value and 2 columns
    By cycloop in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-20-2011, 08:08 AM
  6. Automated comparison between two columns
    By Laura C in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-22-2010, 03:28 PM
  7. Comparison of data in columns
    By anushazy in forum Excel General
    Replies: 1
    Last Post: 06-23-2009, 08:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1