+ Reply to Thread
Results 1 to 15 of 15

Formula to match data with Excel/VBA

  1. #1
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Question Formula to match data with Excel/VBA

    Hi Gurus,

    Would need your kind expertise to help on this request.

    Assuming I’ve the following sample data (see attached) and wishing if the output data could be formatted using some kind of excel formulas.

    For example:
    Sheet1 (Loan)
    Student1 borrowed some books from different catalogues

    Sheet2 (catalogue)
    Books catalogues information

    Sheet3 (Desired Output)
    This is a sample output showing students, books and catalogues matrix that indicates which book that the student has borrowed, it's indicated with "Borrowed"
    If nothing is borrowed, it'll be indicated as "None"

    The sample data could be long and a lot, so it's best if the formula can be made flexible to cater for this requirement.

    Appeciate for any of your help and advice.

    Thank you a lot in advance.
    Attached Files Attached Files
    Last edited by SmallJack; 01-17-2019 at 09:42 PM. Reason: Re-enter information after changing title

  2. #2
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Excel formula to match data

    see attached file.

    Formula used on sheet3:

    HTML Code: 
    Attached Files Attached Files
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

  3. #3
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Excel formula to match data

    Hi modytrane,

    Thanks for your reply and help.

    Probably I didn't provide enough information on the situation, let me add more information so it'll be clearer.

    For the desired output:
    The script/formula should check student in "Sheet1 (Loan)" against "Sheet2 (catalogue)" and provide the matrix in the output.

    For example:
    Student1 borrowed 2 books (Science & Math Adv) from 2 catagues (BookCat1 & BookCat2).
    -> The script should first do the catalogue matching and display all books under these catalogues for Student1.
    -> Next, the script should check and match the book that the sctudent borrowed and indicated it. If not borrowed, also provide the indication.
    -> Columns A, B, C, & D in the output matrix should be populated automatically by the script.

    Hope you could check and help.

    Thank you.





    - Jack
    Attached Files Attached Files
    Regards,
    Jack

  4. #4
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Excel formula to match data

    I am still not clear.
    In the file you attached and example in your msg above, Student 1 borrowed Science from Catalogue1 but on Sheet2 (catalogue) BookCat1 only has Math and Logic. On your desired result Sheet3 you have listed 4 books for Cat1. How does the program know which Catalogue has which books?
    Why don't you list all the available books for each Catalogue on Sheet2?

  5. #5
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Excel formula to match data

    Hi modytrane,

    Thanks for your reply and help.

    Sorry, there were some issues with my sample data posted earlier which I've rectified it.

    I've updated with all the available books on "Sheet2".

    Could you take a look and see if the script is able to provide the desired output?

    Thanks.
    Attached Files Attached Files
    Last edited by SmallJack; 01-16-2019 at 11:39 PM.

  6. #6
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Excel formula to match data

    Hi Gurus,

    Anybody else can help on this case?

    Just guessing maybe with VBA coding will be better?

    Any help will be much appreciated.

    Thanks.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Formula to match data with Excel/VBA

    Full vba.

    If Student2 is not how you wanted, you need explain the clear logic for it.
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Formula to match data with Excel/VBA

    Hi jindon,

    Thanks for your response and help.

    I've tried it and it works perfectly, let me try to populate more data and test it.

  9. #9
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Formula to match data with Excel/VBA

    Hi jindon,

    Sorry for the changes.

    For “Sheet1’ and “Sheet3” both on "Column A", I’ve filled them with the respective data.

    "Sheet1" in "Column A" will not have any blank, so it should be the same on "Sheet3" in "Column A".

    Thought it’ll be easier to manage them this way, easier when doing the sorting as well.

    Possible to have the script process this data in this way?

    Thanks for your help.
    Attached Files Attached Files
    Last edited by SmallJack; 01-18-2019 at 04:16 AM. Reason: Update information

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Formula to match data with Excel/VBA

    Delete one line in red and add one line in bold.
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Formula to match data with Excel/VBA

    Hi jindon,

    Thanks for your help.

    I've modified the script, but the output's row alignment not in order.

    There are some spaces in between, see attached file.

    Could you help to check? Thanks.
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Formula to match data with Excel/VBA

    Perhaps I confused you...
    You have extra n+1
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Formula to match data with Excel/VBA

    Hi jindon,

    It's working as expected now, thank you very much.

    Will close the thread when it's been finalized.

  14. #14
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Formula to match data with Excel/VBA

    Hi Gurus,

    My raw data in worksheet "Sheet1 (Loan)" has grown quite big, roughly about 6000 rows and can be more next time.

    Whenever I tried to process it by excuting the script, it's giving me this error as per below.

    Run-time error '13'
    Type mismatch


    The script with stop at this point due to the above error.
    Please Login or Register  to view this content.

    Anybody can help to check and fix the issue?

    Thank you.
    Attached Images Attached Images
    Last edited by SmallJack; 03-03-2019 at 10:16 PM. Reason: Update error screen capture

  15. #15
    Forum Contributor
    Join Date
    12-30-2006
    Location
    Australia
    MS-Off Ver
    2017
    Posts
    151

    Re: Formula to match data with Excel/VBA

    Hi Gurus,

    Thank you for your help.

    Have a nice 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. [SOLVED] Excel bug? Excel calculated Polynomial formula does not match data, why?
    By Doug_mkk in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 02-13-2020, 11:36 AM
  2. [SOLVED] Index match formula to match related data
    By roven.aravind in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-11-2017, 01:15 AM
  3. Excel formula to match data on multiple worksheets
    By anjoseph9626 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-16-2015, 09:04 AM
  4. Formula To Match Excel Data to Appropriate Node
    By TheProffesional in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-01-2015, 08:13 PM
  5. [SOLVED] Two Excel sheets trying to match text data and return the match from the second column!
    By bankcott in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-02-2013, 02:17 PM
  6. excel formula for Match 2 columns data
    By luke_devon in forum Excel General
    Replies: 7
    Last Post: 10-12-2010, 09:59 AM
  7. Excel formula to find and match the data
    By SmallJack in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2010, 05:13 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