+ Reply to Thread
Results 1 to 20 of 20

DATA across 3 columns and output to 4th

  1. #1
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Post DATA across 3 columns and output to 4th

    Dear all,

    I have a certain Excel workbook which has data stored in 3 columns. Column A has around 300 entries, column B has around 980 and similar for column C. There are certain similar entries between columns A and B.

    What I wish to do is to find all the similar entries between A & B, then match it to the corresponding entry in column C and then give a output in the same worksheet

    I'm attaching the sample for easier understanding and analysis

    Any guidance would be appreciated, solving this basically finishes my entire project
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: DATA across 3 columns and output to 4th

    then match it to the corresponding entry in column C and then give a output in the same worksheet
    What does this mean. Please expand on your explanation in simple language. Give an example using the data you provided.
    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
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: DATA across 3 columns and output to 4th

    What do you mean by:

    ... certain similar entries between columns A and B ...
    If they were exactly the same then you should be able to use this formula in E2:

    =IF(COUNTIF(B:B,A2)>0,VLOOKUP(A2,B:C,2,0),"")

    and copy this down to E300, but I don't see anything returned so the values can't be exactly the same.

    Pete

  4. #4
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Re: DATA across 3 columns and output to 4th

    I'm sorry alansidman and Pete_UK for my absence and delayed reply

    The issue is exactly that...the number of values in A and B isn't the same and hence I turned to the experts here

    To illustrate

    The value in A3 and B4 is the same and the corresponding value is C4

    Basically I want such values to be filtered and displayed

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: DATA across 3 columns and output to 4th

    A3 is not the same as B4. You can check this by putting this formula in an empty cell:

    =B4=A3

    and it will return FALSE. The problem is that you have a <new-line> character (with a code of 10) at the end of most of those entries in column A, which does not appear in column B, so there is no exact match. You can either remove them from column A, or include them within the formula.

    To remove them from column A in one operation (the preferable option), you should highlight the data in column A, then CTRL-H (for Find & Replace), and:

    Find What: Alt-0010
    Replace With: leave blank

    then click Replace All, where Alt-0010 means holding down the Alt key and typing 0010 on the numeric keypad - or you could do CTRL-J in that field. Then you can use the formula that I gave you yesterday in E2, copied down to E300.

    If you want to get rid of them by formula, you need to put this formula in E2:

    =IF(COUNTIF(B:B,SUBSTITUTE(A2,CHAR(10),""))>0,VLOOKUP(SUBSTITUTE(A2,CHAR(10),""),B:C,2,0),"")

    then copy it down to E300.

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Re: DATA across 3 columns and output to 4th

    Thank you for your reply

    The find and replace option isn't working for me..either with Alt+0010 or Ctrl-J..it says not found

    And the formula is giving me some data which is looking like data in column C...I thought the output will be same like column A minus that extra code 10 line

  7. #7
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Re: DATA across 3 columns and output to 4th

    To be clear what I want is the similar entries in A and B to be displayed in column D or E or whatever and the matching values taken from column C to be displayed adjacent to column D or E whichever may be the case

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: DATA across 3 columns and output to 4th

    Here is the file with the formula-solution in.

    Hope this helps.

    Pete
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Re: DATA across 3 columns and output to 4th

    Thank you so much kind sir

    Is there any way I can see the common values from A and B in column E and the corresponding values in C displayed in column F

    Also please tell me how to replicate this as I have 4-5 similar files

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: DATA across 3 columns and output to 4th

    If you want them all bunched up with no gaps between them, then see attached file, which has formulae in D2, E2 and F2, with appropriate headings in row 1. These formulae should be copied down to the bottom of your data in column A (i.e. to row 300) - there is no need to copy them any further, but there is no harm if you do.

    To replicate this in other files, just copy/paste D1:F2 across to the other file, then copy the formulae down.

    Hope this helps.

    Pete
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Re: DATA across 3 columns and output to 4th

    Thanks a lot kind sir

    I was able to successfully follow your instructions and replicate it in my other sheets

    I'm attaching the file you sent with the formulas in D1:F2 along with the data for 2013 and 2014 which I managed from your instructions.

    Now I have two questions

    1) How do I copy the data from columns E and F into a new excel sheet? I tried but it turns out to be blank. I understand it is under some formula and hence turning blank into another sheet.

    But how do I copy just the plain data in E and F?

    2) How do I arrange the data in column E in numerical order and R in the end coming first before L (and also automatically make the changes in F)

    Example

    PEB/002/01/12/R
    PEB/002/01/12/L
    PEB/008/01/12/R
    PEB/008/01/12/L

    and so forth
    Attached Files Attached Files

  12. #12
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: DATA across 3 columns and output to 4th

    In the two sheets you have added you have not copied the formulae down far enough to get all the data - they should be copied to row 333 in the 2013 sheet and to row 417 in the 2014 sheet, as those are the last rows with data in column A.

    To copy the values to another sheet, you need to first of all insert a new sheet - just click on the icon to the right of the 2014 tab to insert a new sheet, and you can do this 3 times to get three new sheets. It might be a good idea to rename them at this stage.

    Then select the 2012 sheet and click on the E and F at the top of the columns to highlight both columns, then click the <copy> icon. Then select one of the new sheets (ensure that cell A1 is selected in it), then right click on that cell and choose Paste Special from the drop-down. Click on Values, then OK. You might also want to right-click again, choose Paste Special, then click on Formats then OK. Finally, right-click again | Paste Special and click on Column Widths then OK. Finally, press the <Esc> key.

    You should then repeat this process for the 2013 sheet into your second new sheet and then for the 2014 sheet into the third new sheet.

    It is better to sort your data once you have the values pasted into the new sheets. Put this formula in C2 of one of the new sheets:

    =IF(A2="","",LEFT(A2,LEN(A2)-1)&IF(RIGHT(A2)="R",0,1))

    and copy it down to the bottom of your data. Then select the data from A1 to the bottom of the data in column C and click Data | Sort, and in the Sort By drop-down select Column C, then click OK. Then you can remove column C, and repeat for the other new sheets.

    Hope this helps.

    Pete
    Last edited by Pete_UK; 03-19-2015 at 03:29 PM.

  13. #13
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Re: DATA across 3 columns and output to 4th

    I've done the copy/paste and sorting as per your formulas

    What struck me here is the counting done by Excel

    Example

    In the '2012 sorted' sheet, the count for columns A and B is shown to be 300 each but visual inspection shows it is 235 each for both

    Similarly 333 shown in 2013, but it is 271

    417 shown in 2014, but it is 344

    Why this disparity and how to correct it?
    Attached Files Attached Files

  14. #14
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: DATA across 3 columns and output to 4th

    Position your cursor in A1 of one of the sorted sheets, then press <End> followed by <down-arrow>, and it will take you way beyond where your data stops. This is because the original formulae in the sheets 2012 etc. were copied to the bottom of the data in column A (i.e. to row 300 in 2012 sheet), but there were only 235 matching items of data, which got bunched up in columns E and F. However, there were still formulae in those lower cells which were returning blanks, so when you copy/pasted the values from those formulae into the sorted sheets, it will have copied the "formula-blanks" into the lower cells. These are not the same as a cell being empty, and the COUNTA function will include them.

    It you want to get rid of them completely, then you can just highlight all the "blank" rows below where your data finishes in the sorted sheets, and click on Delete, then save the file.

    If that takes care of your original question, please select Thread Tools from the menu above your first post and mark this thread as SOLVED.

    Pete

  15. #15
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Post Re: DATA across 3 columns and output to 4th

    Thank you sir

    Attaching the sorted out file..looks mostly okay

    Thanks for all your timely help and guidance
    Attached Files Attached Files

  16. #16
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: DATA across 3 columns and output to 4th

    You're welcome, and glad that you got your result.

    Please mark the thread as SOLVED if you think it is.

    Pete

  17. #17
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Re: DATA across 3 columns and output to 4th

    If I mark it as solved and some days later, realize some issue with the same file then can I reopen or have to post a new thread?

  18. #18
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: DATA across 3 columns and output to 4th

    You can do either.

    It may be better to start a new thread, though, with a link back to this if you think it is necessary, and then new eyes will look at your new thread (some contributors are reluctant to get involved in a long thread that someone else has been helping with).

    Pete

  19. #19
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Re: DATA across 3 columns and output to 4th

    Ok sir

    Thanks once again

  20. #20
    Registered User
    Join Date
    03-16-2015
    Location
    India
    MS-Off Ver
    MS OFFICE 2013 x64
    Posts
    19

    Smile Deleted

    Deleted post
    Last edited by achilles.a; 04-02-2015 at 11:01 PM. Reason: Deleted

+ 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. [SOLVED] Compare columns A and B and output data in A that is NOT in B?
    By steviec in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-17-2015, 12:17 PM
  2. Replies: 6
    Last Post: 12-06-2012, 11:05 AM
  3. Replies: 6
    Last Post: 11-18-2010, 05:12 AM
  4. Looping through columns to copy output into other sheet, and saving output
    By eludlow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2009, 06:27 AM
  5. Replies: 20
    Last Post: 04-04-2007, 05:36 PM

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