4). Using the worksheet Data in the attached file, write a sub that will do the
ID: 3864920 • Letter: 4
Question
4). Using the worksheet Data in the attached file, write a sub that will do the following a). use cell A3 as an anchor cell b). locate the cell where the word Bins is located C). declare a dynamic array (name it Bins) as a single and a dynamic array (name it Cnt) as an integer d). Count the number of bins using range properties (i.e., count, etc) e). re-dimension the array Bins to have the number of bins specified in the worksheet and determine in d) f). re-dimension the array Cnt to have the number of bins plus one g). write a sub that will count the number of times the "amount purchased" is below the first value in the Bins array and place in the first element of the array Cnt, the number of times the "amount purchased" is greater than the first value and less than or equal to the second value in the Bins array and place it in the second element of array Cnt, and so on. The last element of the array Cnt will include the number of times the "amount purchased" exceeds the last value in the Bins array h). write next to the column for the Bins, the numbers collected in the Cnt array. Note that the Cnt array has one more element than the Bins arra Your code should run for a different number of Bins and a different data set with A3 as anchor cell For the example given in the worksheet, the column for Counts will look as follows: Bins Counts 75 100 294 500 63 700 53 1000 61Explanation / Answer
Answer
a.
In order to use the cell A3 as an anchor cell below step has to be taken:
key in =A3 and then press F4 key, A3 will become ur anchor cell
b.
In order to locate the cell where the word Bins is located, in Home tab, in the editing group you will be able to see "Find & Select". Click on Find. Enter "Bin" in Find what box.
c.
In order to declare a dynamic array Bins do the below:
Dim Bins() As Single, size As Single, i As Single
In order to declare a dynamic array Cnt do the below:
Dim Cnt() As Integer, size As Integer, i As Integer
d.
=COUNT(E4:E7)
This will count the number of bins using the range properties.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.