Discount-customers get on minimum quantity of the product


Discussion:

Q. (It uses VBA commands InputBox, MsgBox, Dim, For Next, If Then Else, Cells, Option Explicit and a button)

The below table has a single sheet that lists all 128 of your products by product code. For each product, it lists the unit price and a discount percentage the customers receive if they purchase at least a minimum quantity of the product. For example, the discount for the first product is 7%, and that is obtained if the customer purchases at least 20 units of the product. Write a sub that asks for the number of products you have with an input box. It then ask for a product code. Finally, it should ask for the number of units purchased, which must be a positive number. Your sub should then use a For Next loop to search through your product list to find the product entered. If it finds a match, it should display in message something like the following: "You purchased ___ units of product ___. The total cost is ___. Because you purchased at least ____ units, you get a discount of ____% on each unit." (Replace the underscored areas with the correct values.) The last sentence should not be displayed if the user did not purchase enough units to get a discount. If you do not find a match, your sub should display a message such as "Product not found."

Price information





Product code Unit cost Minimum purchase quantity for discount Discount
C3972 $52 20 7%
C4758 $110 20 5%
L6332 $77 20 3%
P3064 $65 5 3%
C7257 $64 10 3%
O4218 $53 10 3%
J8639 $96 10 3%
A8218 $110 10 7%
I3870 $57 5 7%
G3677 $55 5 3%
H1947 $82 5 5%
E4374 $72 20 7%
N2872 $246 5 7%
D5527 $137 5 3%
G4254 $51 10 3%
E7138 $77 10 3%
E8484 $86 10 7%
P4987 $93 10 5%
E6561 $97 20 7%
I3293 $86 5 5%
K7486 $131 5 5%
H4300 $106 20 3%
C2112 $88 10 7%
M8300 $62 10 5%
B6342 $110 20 5%
W6149 $113 10 3%
A4419 $76 10 5%
M4455 $96 20 7%
G2954 $90 20 5%
L5609 $111 5 5%
W6726 $63 10 3%
R9610 $105 5 3%
S1956 $54 5 5%
I5069 $56 10 7%
S9033 $81 5 3%
B5765 $108 20 5%
D7568 $67 10 7%
A6918 $82 5 5%
P2341 $103 10 3%
G1920 $74 5 5%
O6570 $60 5 5%
M6378 $87 20 5%
N4648 $87 5 3%
F4684 $124 10 3%
W5573 $123 10 5%
E5838 $64 20 5%
M6955 $54 20 7%
K9838 $141 5 5%
K2185 $68 10 7%
F2761 $176 5 7%
W4335 $69 20 7%
D1067 $147 20 3%
F5260 $86 5 5%
C2220 $66 10 5%
S6642 $85 20 7%
D6221 $91 10 7%
R1872 $106 5 3%
O1680 $69 5 5%
R8949 $74 20 3%
H2376 $192 20 7%
C9873 $65 5 3%
G3529 $52 5 5%
O2257 $187 20 7%
M7530 $50 5 3%
N8876 $127 10 3%
T2989 $81 10 3%
M6953 $179 10 7%
R1295 $86 20 5%
T5488 $83 5 5%
R2449 $68 5 5%
K9260 $144 5 7%
R6450 $62 5 5%
E4491 $102 10 3%
H4298 $71 20 5%
J2568 $113 20 7%
A2605 $96 10 5%
P1103 $63 20 3%
W3758 $54 20 5%
H4728 $66 5 5%
F7612 $105 5 3%
A8958 $121 5 3%
L3071 $119 5 5%
F7035 $126 10 3%
E3767 $107 20 7%
L7960 $228 10 5%
D4921 $56 10 3%
D9342 $221 20 3%
J8921 $74 5 5%
S4573 $151 10 3%
A4380 $58 20 3%
C2650 $141 5 5%
N2687 $123 10 5%
I3575 $113 5 3%
M6230 $154 20 3%
A4957 $75 5 3%
T7841 $141 20 7%
N9186 $64 20 3%
E5690 $90 5 7%
T7264 $100 10 7%
S3996 $146 10 3%
E8189 $81 5 7%
R5149 $102 10 3%
R9571 $136 5 7%
C9150 $90 10 3%
K7191 $72 20 5%
N6999 $108 10 3%
P6951 $109 20 3%
P9377 $190 5 3%
K7876 $61 5 5%
O1532 $107 10 5%
C2649 $64 5 7%
A5533 $50 10 3%
P6878 $116 5 7%
G9991 $55 10 7%
A4956 $120 10 7%
W1688 $51 10 7%
G3491 $196 10 3%
T2841 $87 20 5%
N7263 $120 5 7%
E4452 $132 10 7%
M2493 $177 10 7%
K2301 $92 10 3%
M9570 $99 5 3%
J9606 $60 20 5%
D1495 $123 10 7%
I1761 $68 10 3%
K2878 $60 5 5%
I5761 $65 10 3%

Solution Preview :

Prepared by a verified Expert
Other Subject: Discount-customers get on minimum quantity of the product
Reference No:- TGS01932004

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)