Using a list box to post Averages and sums to a TextBox

rholdren

Board Regular
Joined
Aug 25, 2016
Messages
140
Office Version
  1. 365
  2. 2019
Good morning, hope everyone is getting a nice three day weekend and has a safe and excellent holiday
I've looked in several places for an answer and searched my books and can't seem to find an answer,
I'm sure it's something I'm overlooking or just not using the right terms for searching. It seems like
the answer should be pretty smiple but I'm having no luck.
This formula works well in the sheet but I want to use a form to give the user the option to search by
member names in a list box. The form has a list box with members, textbox1 that displays the member name
after the name in the listbox is clicked on Textbox2 that shows the sum of the data and texbox3 that shows
the average of the data

ActiveCell.FormulaR1C1 = _
"=AVERAGEIFS(R[-1]C[-2]:R[24997]C[-2],R[-1]C[-13]:R[24997]C[-13],""John Q Public"")"

ActiveCell.FormulaR1C1 = _
"=SUMIFS(RC[-2]:R[24998]C[-2],RC[-13]:R[24998]C[-13],""Jane Doe"")"

Those two formulas work perfect on the spreadsheet but how do I tell the form
that once listbox1 has changed (clicked on any member of the listbox - currently about 300)
display the Sum in TexBox 2 and the average in TextBox3. Names are in A2 to 25000 and numbers to average or sum are in
L2.L25000
Any help would be greatly appreciated. Thanks
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

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