Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The question requires you to write a VBA code through excel, to find the count of times a value fits into a certain bin. The

image text in transcribed

image text in transcribed

The question requires you to write a VBA code through excel, to find the count of times a value fits into a certain bin. The code should run for any number of entries or any values for "Bins".The data continues of for over 500 entries, but if the program is working for the first ones it should work for all. Basically, you need to use VBA to count the number of times the values in "Amount Purchased" is equal to or less than a Bin and then write that value in the cell next to the Bin. The Cell containing the string "Bins" will not always be in the same spot, hence why you must search for it. The table with "Count" is correct for the data with all 500 entries, but will not be correct for these few entries.

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 array 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 100 75 500 294 700 63 1000 53 61 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 array 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 100 75 500 294 700 63 1000 53 61

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago