+ Reply to Thread
Results 1 to 8 of 8

Macro to compare multiple test cases - example attached

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Macro to compare multiple test cases - example attached

    Hi Guys,

    I have to write difficult macro (because it has to be the fastest macro) to copy/paste data and compare it with expected results.
    2 goals:
    1. Populate data from table tblInput to yellow fields in "Sheet to Check 1"
    2. Compare calculated fields in sheet "Result"


    So I have 4 sheets:
    1) Sheet to Check 1 - here i have to input data into yellow fields from table tblInput from sheet Input.

    I started to doing this:

    Please Login or Register  to view this content.
    - I added one more artificial "Column1" to table tblInput to with easily transpose it to sheet "Sheet to Check 1"
    - I am trying to resize my dictionary to "Sheet to Check 1" yellow fields but only 2 items are transposed, why ?
    - maybe there is better way to do it? Use another objects than Dictionary? (and avoid copy and paste which is very slow).

    Ok so this is for the first part of macro.

    2) Input - Here we have table tblInput
    3) Output - table tblOutput
    4) Result - expected results when comparing green fields with table tblOutput.

    And second part:
    All green fields has to be compared with results from tblOutput in sheet "Result".
    I created this kind of layout but i am open to your ideas.

    How to create the best comparison solution here?
    IF looping within arrays one by one and compare values will be ok here? Or maybe i should use other objects? (arrayList ?)

    And how to get expected layout format?


    Please help,
    Best,
    Jacek
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Macro to compare multiple test cases - example attached

    Hi Guys,

    i saw that anybody has not any ideas for this.

    I did first part of macro, including comparison.

    Please Login or Register  to view this content.
    This is comparing string as hash codes and should be the fastest way for large files.
    This is ok.
    Feel free to ask your thoughts, ideas for it here.

    Now second part,
    Results should be like in sheet expected result:

    Screenshot_5.png

    So how to copy all rows from output sheet to result sheet and mark this with differences?

    Best,
    Jacek

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Macro to compare multiple test cases - example attached

    Ok problem with the first function is how to find out which value is not equal and is different.

    How can i catch it?

    Best,
    Jacek

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Macro to compare multiple test cases - example attached

    Maybe you @jindon can help?

    I changed code and now i am retrieving also arrays from RangeCompare function:

    Please Login or Register  to view this content.
    and now my idea is to find which row has differences and pass it to dictionary (which can be easily outputted later).

    Please Login or Register  to view this content.


    I am thinking because i am looping once again here (previously in function) , can i use dictioanry or other objects or something like this to avoid this?
    Some unique key?

    Best,
    Jacek
    Attached Files Attached Files

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

    Re: Macro to compare multiple test cases - example attached

    I just don't understand what you are trying to do...

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Macro to compare multiple test cases - example attached

    Hi jindon,

    please ask.

    In Simle way -
    1) i want to copy and paste from each record (unique Order column name) from table from sheet tblInput into yellow fields into sheet "Sheet to Check1" and do not use copy and paste methods - they are slow. (each record tblInput --> copy and paste into yellow fields into "Sheet to Check 1").
    2) And each green field (caculated based on yellow fields in "sheet to check 1") i want to compare with sheet and table Output and show results like in the screen.

    So i am taking Order = 1 row in tblInput, copying it and pasting to yellow fields "sheet to check 1", based on that green fields are caclulated.
    And now i have to compare green fields with tblOutput with the same Order = 1 and show differences...
    Expected result is Output table but with differences shown.

    Please help,
    Best,
    Jacek
    Last edited by jaryszek; 10-05-2018 at 06:15 AM.

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

    Re: Macro to compare multiple test cases - example attached

    Not really sure...
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Macro to compare multiple test cases - example attached

    very nice solution, thank you very much!

    I will test it for my purposes.

    Best,
    Jacek

+ 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] Formulae assist - File attached (Test)
    By Pi* in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-11-2016, 09:32 PM
  2. Multiple cases Macro
    By Harrinho in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2016, 07:35 PM
  3. VBA to compare two sheets and highlight differences (basic test file attached)
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-17-2015, 12:23 PM
  4. Execute Test Cases in QC through VBA
    By HP_1260 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2015, 01:07 PM
  5. [SOLVED] Need to Create a new Analysis Sheet based on Existing Sheets Failed Test cases
    By Kandavalli.Kiran in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-11-2015, 01:44 AM
  6. Building a test plan from database of cases-steps
    By threesidedorchid in forum Excel General
    Replies: 2
    Last Post: 08-08-2014, 08:54 AM
  7. Downloading test cases from QC
    By kiran527 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2012, 08:19 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