Stephen_IV
Well-known Member
- Joined
- Mar 17, 2003
- Messages
- 1,180
- Office Version
- 365
- 2019
- Platform
- Windows
Good evening,
I am looking for VBA to do some unique counting for me. I have over 200000 rows of data. The formula approach I have been using is below. But I really want to automate to VBA.
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>STUDENTID</th><th>SCHOOLID</th></tr></thead><tbody>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>113</td><td>2207264</td></tr>
<tr><td>113</td><td>2207264</td></tr>
<tr><td>113</td><td>2216264</td></tr>
<tr><td>113</td><td>2216264</td></tr>
<tr><td>113</td><td>2209264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2209264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
</tbody></table>
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>STUDENTID</th><th>SCHOOLID</th></tr></thead><tbody>
<tr><td>100</td><td>1</td></tr>
<tr><td>113</td><td>3</td></tr>
<tr><td>127</td><td>2</td></tr>
</tbody></table>
I am looking for VBA to do some unique counting for me. I have over 200000 rows of data. The formula approach I have been using is below. But I really want to automate to VBA.
Code:
{=SUM(IF(FREQUENCY(IF(($A$2:$A$22=F2),$B$2:$B$22),$B$2:$B$22)>=1,1))}
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>STUDENTID</th><th>SCHOOLID</th></tr></thead><tbody>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>100</td><td>2207264</td></tr>
<tr><td>113</td><td>2207264</td></tr>
<tr><td>113</td><td>2207264</td></tr>
<tr><td>113</td><td>2216264</td></tr>
<tr><td>113</td><td>2216264</td></tr>
<tr><td>113</td><td>2209264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2209264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
<tr><td>127</td><td>2216264</td></tr>
</tbody></table>
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>STUDENTID</th><th>SCHOOLID</th></tr></thead><tbody>
<tr><td>100</td><td>1</td></tr>
<tr><td>113</td><td>3</td></tr>
<tr><td>127</td><td>2</td></tr>
</tbody></table>
Last edited: