Match up data based on pre-existing data

thechad

Board Regular
Joined
Apr 28, 2014
Messages
118
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Greetings,

I would like to develop some code that would line up rows of data with cells that have matching values in column B & C on the same row. Clear as mud I know!!!:laugh:

It would be easier with a picture!

Anyway...I have a list of badge numbers in column B, rows 7 thru 11 as 1,2,3,4,5. Data is manually pasted to the right of column B in column C with badge numbers in column C and other data from column D to I. The badge numbers in column C will typically be the same as column B but in a different order (i.e. 5,4,2,1,3). I would like the code to line up columns B & C badge numbers and all the information from columns D to I being sorted accordingly. Also, if there are additional badge numbers in column C that don't appear in column B, I would like them, along with column D to I information being placed at the bottom of the list.

I hope this is understandable.

Thanks!!!!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Where is the column C:I being copied from? With VBA, I think it would be easier to match during the transfer than after.
Code:
Range("C7:I11").FormulaR1C1 = "=VLOOKUP(RC2,Sheet1!R1C1:R500C7,COLUMN(R[1]C)-1,FALSE)"

For find the unmatched values, you'll want a loop to check if the value exists and copy it over if it doesn't.
 
Upvote 0
The information in C:I is being manually pasted from another program as values only.
 
Upvote 0
I'd suggest a 2D array to hold the information that was manually pasted in C7:I11. Then, a loop to compare badge numbers for each row; pasting the data to the sheet and removing the data from the array. The left over would then be input into the blank rows that follow the previous pasted data.
 
Upvote 0
OK, let's take it step by step. What's the first snag in your solution? Have you started the macro, yet?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top