Macro: combining multiple cells to create a unique string of numbers

The Cap

New Member
Joined
Oct 26, 2017
Messages
1
Hello. I'm trying to automate a tedious task of typing each device number manually. I wonder if there is a possibility of creating a macro that'd speed up the process.

All other values are given beforehand. The logic behind each device number goes as follows: First two numbers are fixed and wont change. The third and fourth number state the room the device is located (from the Room No. column, the last two chars of a Room No.). Fifth and the final number is created based on Device Type. 1 - n (there can be more than two) = CCC500, 5 = FFF850, 7 = FFF800, 8 = FFF810 and so on...

The values of the last variable aren't set on stone as described above, as the number of devices in a room varies and duplicates aren't allowed. Is there a possibility to create a simple macro that'd to fill the Device Number column with unique IDs using the logic I explained above?

Thank you in advance!

7667238Capture.PNG
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You can do this with a formula:

Code:
="10"&RIGHT(A2,2)&VLOOKUP(E2,lookup_table,2,FALSE)

For the last piece (The Vlookup), I'd create a little remapping table. First column is your Device Type, and second column is the number you want returned as the last digit of the Device Number. Name this table "lookup_table".
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,313
Members
452,634
Latest member
cpostell

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