InPlace is a nifty little module for Excel that helps with merging tables of information or cross-checking for overlapping data.
InPlace contains two macros:
- Align In Place: For two tables of information on the same sheet and with sorted ids in the first column it will align the ids so that they match, inserting blank rows in either table whenever there is a mismatch.
- Match in Place: For two tables of information on the same sheet and with the first table containing blank rows, it will insert blank rows on the second table to match those of the first. This macro can be used, for example, after Align In Place has introduced blank rows in your first table, to match a second table of information to the first, preserving the gaps.
- Download InPlace.bas from this repository to your computer (File -> Save)
- In Excel, you need to enable the Developer ribbon, as described here
- Click on the Editor button to open up the Project window
- Right-click anywhere in the white space of the Project window and select Import File...
- Browse for InPlace.bas (which you downloaded in step 1) and import it
- Prepare your Excel sheet (as described in the Overview) and click on Macros (from the Developer ribbon) and either AlignInPlace or MatchInPlace
NOTE:
Macros cannot be undone. Make sure you save your file before attempting to use these scripts to save yourself from ugly surprises!
Once you run the macro as described above, it will ask you for some information:
- The first comparison column: This is the first column of the first table and must contain sorted ids
- The first range column: This is the last column of the first table
- The second comparison column: This is the first column of the second table and must contain sorted ids
- The second range column: This is the last column of the second table
- The starting row: If you have headers in the first row, enter "2"
Then you will get a confirmation dialog. Check if everything makes sense and click OK.
Once you run the macro as described above, it will ask you for some information:
- The template column: This is a column that contains some blank rows which you wish to instroduce to your target table
- The first target column: This is the first column of the target table
- The range column: This is the last column of the target table
- The starting row: If you have headers in the first row, enter "2"
- The end row: Since there are blank rows in your template column, there is no easy way to know where your data ends, so you need to enter the last row that contains data here (an estimate will be given by defualt)
Then you will get a confirmation dialog. Check if everything makes sense and click OK.
I hope you find these macros useful. If you need more help, please contact me! I'd be happy to hear from you.
Please submit feature requests and bug reports via github.