Listbox Array calculation by first column

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,280
Office Version
  1. 2013
Platform
  1. Windows
Column AColumn BColumn MColumn N
MONTHDATECUSTOMER ID#FIRST NAMELAST NAMEDATADATADATADATADATADATADATAPOINTSPOINTSDATA
June7-Jun-2018 5,0008,000
June7-Jun-2018 5,1008,100
June7-Jun-2018 5,2008,200
June7-Jun-2018 5,3008,300
June7-Jun-2018 5,4008,400
June8-Jun-2018 5,5008,500
June8-Jun-2018 5,6008,600
June8-Jun-2018 5,7008,700
June8-Jun-2018 5,8008,800
June8-Jun-2018 5,9008,900
June8-Jun-2018 6,0009,000
July5-Jul-2018 6,1009,100
July5-Jul-2018 6,2009,200
July7-Jul-2018 6,3009,300
July8-Jul-2018 6,4009,400
July9-Jul-2018 6,5009,500
July9-Jul-2018 6,6009,600
July9-Jul-2018 6,7009,700
August3-Aug-2018 6,8009,800
August3-Aug-2018 6,9009,900
August3-Aug-2018 7,00010,000
August3-Aug-2018 7,10010,100
August7-Aug-2018 7,20010,200
August7-Aug-2018 7,30010,300

<colgroup><col><col><col><col span="2"><col><col span="2"><col span="2"><col><col span="3"><col></colgroup><tbody>
</tbody>



Hello above data filtering by below code from first column,

Code:
Private Sub ComboBox2_Change()



Dim a, i As Long, ii As Long, b(), n As Long
ListBox1.Clear
With ComboBox2


If .Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Worksheets("list").Range("a:a"), .Text) = 0 Then


Exit Sub
End If
a = Worksheets("list").Range("a1").Resize(Worksheets("list").Range("a" & Rows.Count).End(xlUp).Row, 15).Value
For i = 1 To UBound(a, 1)
If a(i, 1) = .Text Then
n = n + 1: ReDim Preserve b(1 To 15, 1 To n)
For ii = 1 To UBound(a, 2)
b(ii, n) = a(i, ii)
Next
b(2, n) = Format$(a(i, 2), "dd-mmm-yyyy")
'b(5, n) = Format$(a(i, 5), "h:mm")
End If
Next
End With
With ListBox1
.ColumnCount = 15
.ColumnWidths = "0;60;60;120;120;0;0;0;0;0;0;0;100;100;0"
.Column = b
End With
End Sub


Is it possible to filter those datas into the listbox as given table below?
Column M and Column N values will sum base on column A data.
If I select June the list must populate as given table.
Many Thanks





MONTHDATECUSTOMER ID#FIRST NAMELAST NAMEDATADATADATADATADATADATADATAPOINTSPOINTSDATA
June7-Jun-2018 26,00041,000
June8-Jun-2018 34,50052,500
July5-Jul-2018 12,30018,300
July7-Jul-2018 6,3009,300
July8-Jul-2018 6,4009,400
July9-Jul-2018 19,80028,800
August3-Aug-2018 27,80039,800
August7-Aug-2018 21,80020,500

<colgroup><col><col><col><col span="2"><col><col span="2"><col span="2"><col><col span="3"><col></colgroup><tbody>
</tbody>
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,214,918
Messages
6,122,249
Members
449,075
Latest member
staticfluids

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