how to sum numbers greater than the average without using worksheet functions

Reeza

New Member
Joined
Oct 22, 2015
Messages
4
So I needed to create a random range and then calculate the average of that range. Once the average is calculated I need to:

A) Calculate how many numbers are greater than the average, highlight all numbers greater than the average and place the amount of numbers that are greater than the average in a cell.

B) Calculate the sum of the numbers that are greater than the average and place that in a cell. However I need to calculate the sum without using the worksheet function.The code below creates a random range, and works out an average. If there is a more efficient way to do so, please feel free to contribute.

I am Using Excel 2010


Sub Example1()
Dim RandRange As Range

Set ExampleRange = Range("C2:J12")
With ExampleRange
.Formula = "=Rand()"
.Font.Bold = True
End With


With Range("C14")
.Value = "Average"
.Offset(0, 1).Name = "Average"
.Offset(0, 1).Formula = "=average(RandRange)"
End With
'Insert Sum
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,216,106
Messages
6,128,863
Members
449,473
Latest member
soumyahalder4

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