VBA help with creating a unique list

Access Beginner

Active Member
Joined
Nov 8, 2010
Messages
311
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I have a list of dataset on a sheet called "DATA_HOLDINGS". This has columns of "libname","dataset","variable","type,"lenght" and "varnum". This list at the moment is 40,733 but will grow.
Under the column "dataset", there are dataset names with a list of variables for that dataset. The issue I have is that there are datasets that are exactly the same in terms of variables, but the datasets are
monthly eg. Dataset190710,Dataset190810.Dataset190910,Dataset191010 etc Each of these datasets will have the same variables. There are other datasets wich are monthly and these will have different variables.
Can someone please be able to create code so that a new sheet is created where a unqiue list of datasets are created,but still have all the "variable","type,"lenght" and "varnum"
.
Current Output



libname

dataset
variable
type
length
varnum
Lib1
Dataset190710
Variable1
char
30
1
Lib1
Dataset190710

Variable2
char
7
2
Lib1
Dataset190710
Variable3
char
1
3
Lib1
Dataset190710
Variable4
char
1
4
Lib1
Dataset190710
Variable5
num
8
5
Lib1
Dataset190710
Variable6
char
3
6
Lib1
Dataset190710
Variable7
char
3
7
Lib1
Dataset190810
Variable1
char
1
8
Lib1
Dataset190810
Variable2
char
3
9
Lib1
Dataset190810

Variable3
num
8
10
Lib1
Dataset190810

Variable4
num
8
11
Lib1
Dataset190810

Variable5
char
3
12
Lib1
Dataset190810

Variable6
num
8
13
Lib1
Dataset190810

Variable7
char
3
14

<tbody>
</tbody>




Expected Output


libname
dataset
variable
type
length
varnum
Lib1
Dataset190710
Variable1
char
30
1
Lib1
Dataset190710
Variable2
char
7
2
Lib1
Dataset190710
Variable3
char
1
3
Lib1
Dataset190710
Variable4
char
1
4
Lib1
Dataset190710
Variable5
num
8
5
Lib1
Dataset190710
Variable6
char
3
6
Lib1
Dataset190710
Variable7
char
3
7

<tbody>
</tbody>



Some datsets have 2 years worth of monthly data. There will also be different libnames
 
Last edited:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,214,984
Messages
6,122,601
Members
449,089
Latest member
Motoracer88

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