instanceoftime
Board Regular
- Joined
- Mar 23, 2011
- Messages
- 103
I have excel invoices that may or may not contain all categories listed below. I would like to run a macro that will search for each category and then give me a total extended retail of each category. I used to use they following code but my category list is getting so long that there has to be a simpler code. Please help me.
category list (partial) (I have 210)
category list (partial) (I have 210)
Apparel |
Athletic Equipment |
Bathroom/Kitchen Hardware |
Batteries |
Bedding |
VBA Code:
Sub Domestics()
'
' Domestics Macro
'
' Keyboard Shortcut: Ctrl+d
'
myRange = ActiveSheet.Range("H1", Range("H1").End(xlDown))
Range("Q9") = WorksheetFunction.Sum(myRange)
Set MyRg1 = Range("K:K")
Set MyRg2 = Range("H:H")
Cells(1, "O") = WorksheetFunction.SumIf(MyRg1, "Rugs", MyRg2)
Range("N1").Value = "Rugs"
Set MyRg1 = Range("K:K")
Set MyRg2 = Range("H:H")
Cells(2, "O") = WorksheetFunction.SumIf(MyRg1, "Garage Storage", MyRg2)
Range("N2").Value = "Garage Storage"
Columns("N:N").ColumnWidth = 14.29
Range("Q9").Select
Selection.Cut
Range("O4").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-12
Range("P1").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R[3]C[-1]"
Range("P2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R[2]C[-1]"
Columns("P:P").Select
Selection.NumberFormat = "0.00%"
Selection.NumberFormat = "0%"
Columns("P:P").Select
Selection.Cut
Columns("O:O").Select
Selection.Insert Shift:=xlToRight
Range("Q9").Select
End Sub
cstSUM-3800477.csv | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | |||
1 | Lot # | Item # | Dept. Code | Department | Item Description | Qty | Unit Retail | Ext. Retail | Category Code | Brand | Category | ||
2 | 3800477 | 2621060 | 26 | SPORTING GOODS | SEALY ALWAYZAIRE TOUGH | 7 | 149.99 | 1049.93 | DAD | BESTWAY HNG KNG INTL LTD | Camping Goods | ||
3 | 3800477 | 1355300 | 23 | HARDWARE | FEIT FLOODLIGHT CAMERA | 7 | 129.99 | 909.93 | GVC | FEIT ELECTRIC COMPANY | Home Safety | ||
4 | 3800477 | 1549651 | 23 | HARDWARE | MOEN 5-SERIES ELONGATED | 2 | 399.99 | 799.98 | MAM | MOEN INCORPORATED | Bathroom/Kitchen Hardware | ||
5 | 3800477 | 1312642 | 20 | HEALTH & BEAUTY AIDS | HAIRMAX LASERBAND 82 BUND | 1 | 679.99 | 679.99 | HRR | LEXINGTON INTERNATNL LLC | Hair Care | ||
6 | 3800477 | 1677269 | 20 | HEALTH & BEAUTY AIDS | IRESTORE PROFESSIONAL | 1 | 649.99 | 649.99 | HRR | FREEDOM LASER THERAPY INC | Hair Care | ||
7 | 3800477 | 2437599 | 33 | SMALL APPLIANCES | SHARPER IMAGE PRO | 8 | 79.99 | 639.92 | UCA | MERCHSOURCE LLC | Massage/Relaxation | ||
8 | 3800477 | 1529869 | 34 | DOMESTICS | NOVAFORM COMFORT GRANDE | 21 | 29.99 | 629.79 | DAF | FXI INC | Pillows | ||
9 | 3800477 | 1689295 | 20 | HEALTH & BEAUTY AIDS | COLGATE TOOTHBRUSH ADV | 37 | 16.99 | 628.63 | DCB | COLGATE PALMOLIVE CO | Oral Care | ||
10 | 3800477 | 1193817 | 23 | HARDWARE | BARRISTER COACH LIGHT | 15 | 39.99 | 599.85 | ADV | ALTAIR LIGHTING | Lighting | ||
11 | 3800477 | 5978082 | 33 | SMALL APPLIANCES | WATERPIK WATERFLOSSER | 6 | 89.99 | 539.94 | VDA | WATER PIK INC | Oral Care | ||
12 | 3800477 | 1510415 | 23 | HARDWARE | FEIT LED 7.5" FLAT PANEL | 7 | 64.99 | 454.93 | UGB | FEIT ELECTRIC COMPANY | Light Bulbs | ||
13 | 3800477 | 2622199 | 26 | SPORTING GOODS | SAMSONITE RENEW SOFTSIDE | 2 | 224.99 | 449.98 | GLS | SAMSONITE LLC | Luggage | ||
14 | 3800477 | 2000512 | 26 | SPORTING GOODS | AEROBED COMFORTLOCK AIR | 3 | 149.99 | 449.97 | DAD | COLEMAN COMPANY INC | Camping Goods | ||
15 | 3800477 | 1108569 | 34 | DOMESTICS | SERENITY MEM FOAM PILLOW | 15 | 29.99 | 449.85 | DAF | COMFORT REVOLUTION LLC | Pillows | ||
16 | 3800477 | 1644312 | 20 | HEALTH & BEAUTY AIDS | SKIN INC OPTIMIZER VOYAGE | 2 | 194.99 | 389.98 | KLD | NATIONAL DISTRIBUTORS | Facial Care | ||
17 | 3800477 | 1635661 | 34 | DOMESTICS | PENDLETON 5-PIECE KING | 3 | 109.99 | 329.97 | GCA | BHF INTERNATIONAL LTD | Bedding | ||
18 | 3800477 | 2322007 | 23 | HARDWARE | TOMMY BAHAMA BOLLARD | 5 | 59.99 | 299.95 | NAA | ALPAN LIGHTING PRDTS INC | Landscape Lighting | ||
19 | 3800477 | 2622071 | 26 | SPORTING GOODS | SWINGING HAMMOCK CHAIR | 6 | 49.99 | 299.94 | DDC | RIO BRANDS LLC | Camping Goods | ||
20 | 3800477 | 1306090 | 34 | DOMESTICS | KS 680TC QUEEN SHEET SET | 4 | 69.99 | 279.96 | AAA | HIMATSINGKA AMERICA INC | Bedding | ||
21 | 3800477 | 1662127 | 28 | TOYS/SEASONAL | AMAX ASC-2600 DRONE | 4 | 69.99 | 279.96 | AHA | AMAX GROUP USA LLC | Toys | ||
22 | 3800477 | 2398697 | 33 | SMALL APPLIANCES | WAHL DELUXE HAIRCUT KIT | 7 | 39.99 | 279.93 | WDA | WAHL CLIPPER CORP | Shavers | ||
23 | 3800477 | 1515094 | 34 | DOMESTICS | GA HENLEY RUNNER 26"X96" | 11 | 24.99 | 274.89 | JAC | GA GERTMENIAN AND SONS | Rugs | ||
24 | 3800477 | 1637099 | 26 | SPORTING GOODS | SAMSONITE RENEW 2PC S/S | 1 | 229.99 | 229.99 | GLS | SAMSONITE LLC | Luggage | ||
25 | 3800477 | 1500673 | 34 | DOMESTICS | PURE EARTH 300TC QUEEN | 5 | 44.99 | 224.95 | AAD | INDO COUNT INDUSTRIES LTD | Bedding | ||
26 | 3800477 | 1261588 | 23 | HARDWARE | RING ALARM SECURITY KIT | 1 | 219.99 | 219.99 | GYC | RING LLC | Home Safety | ||
27 | 3800477 | 1617624 | 23 | HARDWARE | MOEN LISO BATHROOM FAUCET | 3 | 69.99 | 209.97 | MAL | MOEN INCORPORATED | Bathroom/Kitchen Hardware | ||
28 | 3800477 | 1575003 | 21 | OFFICE SUPPLIES | FGX PLASTIC 3PK READING | 11 | 18.99 | 208.89 | WRA | FGX INTERNATIONAL INC | Reading Glasses | ||
29 | 3800477 | 4874103 | 34 | DOMESTICS | AMTEX SEALY DOWNALT KING | 8 | 25.99 | 207.92 | DAB | AMERICAN TEXTILE CO INC | Pillows | ||
30 | 3800477 | 1232805 | 23 | HARDWARE | PANASONIC HOMEHAWK FRONT | 1 | 199.99 | 199.99 | GVA | PANASONIC WESTERN GROUP | Home Safety | ||
31 | 3800477 | 1552493 | 26 | SPORTING GOODS | FROGG TOGGS MENS | 2 | 99.99 | 199.98 | NEC | NATIONAL DISTRIBUTORS | Fishing/Hunting | ||
32 | 3800477 | 1635660 | 34 | DOMESTICS | PENDLETON 5-PIECE QUEEN | 2 | 99.99 | 199.98 | GCA | BHF INTERNATIONAL LTD | Bedding | ||
33 | 3800477 | 1600334 | 23 | HARDWARE | LED SOLAR STRING LIGHT | 5 | 39.99 | 199.95 | BBE | SUNFORCE PRODUCTS INC | Lighting | ||
34 | 3800477 | 1600819 | 34 | DOMESTICS | ECO BLANKET QN P60 | 10 | 19.99 | 199.9 | IAA | BERKSHIRE BLANKET AND | Blankets | ||
35 | 3800477 | 1560301 | 34 | DOMESTICS | BROOKSTONE HEATED THROW | 6 | 32.99 | 197.94 | IEA | LONDON LUXURY | Blankets | ||
36 | 3800477 | 2622158 | 26 | SPORTING GOODS | RICARDO WINDSOR 2PC | 1 | 179.99 | 179.99 | GLH | RICARDO BEVERLY HILLS | Luggage | ||
37 | 3800477 | 829923 | 23 | HARDWARE | FIRST ALERT 10YR PE SMOKE | 6 | 29.99 | 179.94 | GBB | BRK BRANDS INC | Home Safety | ||
38 | 3800477 | 1562702 | 34 | DOMESTICS | CHARISMA MF SHEETS KING | 9 | 19.99 | 179.91 | AAC | JIANGSU ROYAL HME USA INC | Bedding | ||
39 | 3800477 | 4874102 | 34 | DOMESTICS | AMTEX SEALY DOWNALT ST/QN | 9 | 19.99 | 179.91 | DAB | AMERICAN TEXTILE CO INC | Pillows | ||
40 | 3800477 | 1600327 | 23 | HARDWARE | KOHLER LAYNE TOILET SEAT | 7 | 24.99 | 174.93 | MAM | KOHLER COMPANY | Bathroom/Kitchen Hardware | ||
41 | 3800477 | 1544678 | 23 | HARDWARE | FIRST ALERT 10YR COMBO | 3 | 54.99 | 164.97 | GBB | BRK BRANDS INC | Home Safety | ||
42 | 3800477 | 1623499 | 34 | DOMESTICS | PNDLTN SHERPA KING P60 | 5 | 32.99 | 164.95 | IAA | BHF INTERNATIONAL LTD | Blankets | ||
43 | 3800477 | 1600246 | 23 | HARDWARE | ENERGETIC LIGHTING 14" | 6 | 26.99 | 161.94 | ADA | YANKON LIGHTING INC | Lighting | ||
44 | 3800477 | 1306091 | 34 | DOMESTICS | KS 680TC KING SHEET SET | 2 | 79.99 | 159.98 | AAA | HIMATSINGKA AMERICA INC | Bedding | ||
45 | 3800477 | 1446904 | 32 | HOUSEWARES | SIMPLEHUMAN SOAP | 2 | 79.99 | 159.98 | SBZ | SIMPLEHUMAN LLC | Bathroom Essentials | ||
46 | 3800477 | 2622037 | 26 | SPORTING GOODS | CMT HIGH BACK CHAIR | 4 | 38.99 | 155.96 | DDC | CASCADE MOUNTAIN | Camping Goods | ||
47 | 3800477 | 1583098 | 23 | HARDWARE | KOHLER PROSECCO HANDHELD | 3 | 49.99 | 149.97 | MAK | KOHLER COMPANY | Bathroom/Kitchen Hardware | ||
48 | 3800477 | 2020898 | 23 | HARDWARE | OVE WATERFALL STRING | 3 | 49.99 | 149.97 | BBE | OVE DECORS ULC | Lighting | ||
49 | 3800477 | 1539535 | 34 | DOMESTICS | 5PC ROSLYN BATH SET | 4 | 34.99 | 139.96 | CAC | SILK HOME INC | Linens | ||
50 | 3800477 | 1625149 | 23 | HARDWARE | DURACELL+ AA 40PK | 7 | 18.99 | 132.93 | CAB | DURACELL DISTRIBUTING INC | Batteries | ||
51 | 3800477 | 1623497 | 34 | DOMESTICS | PNDLTN SHERPA TWIN P90 | 6 | 21.99 | 131.94 | IAA | BHF INTERNATIONAL LTD | Blankets | ||
52 | 3800477 | 1137197 | 23 | HARDWARE | 3M 2200 SERIES 14X25X1 | 2 | 64.99 | 129.98 | OGE | 3M COMPANY | Filters | ||
53 | 3800477 | 1430577 | 23 | HARDWARE | 3M 2200 SERIES 14X30X1 | 2 | 64.99 | 129.98 | OGE | 3M COMPANY | Filters | ||
54 | 3800477 | 1511902 | 34 | DOMESTICS | BRENTORG MODERN FARMHOUSE | 10 | 12.99 | 129.9 | EAA | BRENTWOOD ORIGINALS | Pillows | ||
55 | 3800477 | 1648970 | 23 | HARDWARE | FEIT WIFI SMART BULB 4PK | 5 | 24.99 | 124.95 | UYG | FEIT ELECTRIC COMPANY | Light Bulbs | ||
56 | 3800477 | 1401468 | 26 | SPORTING GOODS | TRAVELER'S CHOICE CREEK | 1 | 119.99 | 119.99 | GLH | TRAVELERS CHOICE TRVLWARE | Luggage | ||
57 | 3800477 | 1639599 | 34 | DOMESTICS | RETRO CHIC 3PC QUILT KG | 2 | 59.99 | 119.98 | GDA | PEM AMERICA INC | Bedding | ||
58 | 3800477 | 1652880 | 34 | DOMESTICS | WOVEN STRIPE SHEET Q | 2 | 59.99 | 119.98 | AAA | INDO COUNT INDUSTRIES LTD | Bedding | ||
59 | 3800477 | 3333004 | 33 | SMALL APPLIANCES | OMNI BREEZE TOWER FAN | 3 | 39.99 | 119.97 | MED | NINGBO SINGFUN ELECTRIC | Fans | ||
60 | 3800477 | 1528977 | 23 | HARDWARE | FEIT 2PK SMART DIMMER | 4 | 29.99 | 119.96 | BYP | FEIT ELECTRIC COMPANY | Lighting/Electrical | ||
61 | 3800477 | 1487782 | 21 | OFFICE SUPPLIES | ROYAL SHREDDER 10 SHEET | 2 | 56.99 | 113.98 | KFD | ROYAL CONSUMER | Office Supplies | ||
62 | 3800477 | 2622167 | 26 | SPORTING GOODS | TITAN 50 CAN COLLAPSIBLE | 3 | 36.99 | 110.97 | AAF | CALIFORNIA INNOVATIONS | Coolers | ||
63 | 3800477 | 1500674 | 34 | DOMESTICS | PURE EARTH 300TC KING | 2 | 54.99 | 109.98 | AAD | INDO COUNT INDUSTRIES LTD | Bedding | ||
64 | 3800477 | 1372222 | 34 | DOMESTICS | CASPER THE ESSENTIAL PILL | 3 | 34.99 | 104.97 | DAB | CASPER SLEEP INC | Pillows | ||
65 | 3800477 | 1431543 | 26 | SPORTING GOODS | ALPTREK OUTDOOR BLANKET | 4 | 25.99 | 103.96 | DGD | CASCADE MOUNTAIN | Camping Goods | ||
66 | 3800477 | 721653 | 34 | DOMESTICS | GLORY WISDOM SHEEPSKIN | 1 | 99.99 | 99.99 | JAB | GLORY WISDOM CORP | Rugs | ||
67 | 3800477 | 1036200 | 31 | WOMENS APPAREL | 30S2GHMS3L MK HAMILTON EW | 1 | 99.99 | 99.99 | HHM | Q E COMMERCE | Handbags | ||
68 | 3800477 | 2622061 | 26 | SPORTING GOODS | CORE 6P 400 LUMEN | 1 | 99.99 | 99.99 | DEA | ELEVATE LLC | Camping Goods | ||
69 | 3800477 | 1389396 | 26 | SPORTING GOODS | WILSON TENNIS RACKET P56 | 2 | 49.99 | 99.98 | HCA | WILSON SPORTING GOODS CO | Athletic Equipment | ||
70 | 3800477 | 1583883 | 33 | SMALL APPLIANCES | SHARPER IMAGE COMPACT | 2 | 49.99 | 99.98 | UCA | MERCHSOURCE LLC | Massage/Relaxation | ||
71 | 3800477 | 1590219 | 34 | DOMESTICS | NIGHT SILK CASE GRAY QN | 2 | 49.99 | 99.98 | AAB | DISCOVER NIGHT LLC | Bedding | ||
72 | 3800477 | 1649240 | 23 | HARDWARE | KS FURNACE FILTER 14X24X1 | 2 | 49.99 | 99.98 | OGE | KIMBERLY CLARK CORP | Filters | ||
73 | 3800477 | 1600820 | 34 | DOMESTICS | ECO BLANKET KG P48 | 4 | 24.99 | 99.96 | IAA | BERKSHIRE BLANKET AND | Blankets | ||
74 | 3800477 | 1528975 | 23 | HARDWARE | FEIT WIFI SMART BULB 2PK | 5 | 19.99 | 99.95 | UYG | FEIT ELECTRIC COMPANY | Light Bulbs | ||
75 | 3800477 | 4008100 | 27 | GARDEN | RAPID FLO GARDEN HOSE | 2 | 48.99 | 97.98 | JAA | TEKNOR APEX COMPANY | Gardening | ||
76 | 3800477 | 1048765 | 34 | DOMESTICS | AH RDS BLANKET WHITE QN | 1 | 94.99 | 94.99 | IAD | ALLIED HOME LLC | Blankets | ||
77 | 3800477 | 1434748 | 34 | DOMESTICS | AH RDS BLANKET GREEN QN | 1 | 94.99 | 94.99 | IAA | ALLIED HOME LLC | Blankets | ||
78 | 3800477 | 1575001 | 21 | OFFICE SUPPLIES | FGX LIMITED 3PK READING | 5 | 18.99 | 94.95 | WRA | FGX INTERNATIONAL INC | Reading Glasses | ||
79 | 3800477 | 1591972 | 32 | HOUSEWARES | MIKASA WOOD LANTERN 2PK | 2 | 46.99 | 93.98 | HFE | LIFETIME BRANDS INC | Home Decor | ||
80 | 3800477 | 1450813 | 34 | DOMESTICS | JA 4PC SHEET SET KG BEIGE | 1 | 89.99 | 89.99 | AAB | JENNIFER ADAMS MFG INC | Bedding | ||
81 | 3800477 | 1450826 | 34 | DOMESTICS | JA ETERNAL 3P DUV K BEIGE | 1 | 89.99 | 89.99 | GAA | JENNIFER ADAMS MFG INC | Bedding | ||
82 | 3800477 | 1608201 | 26 | SPORTING GOODS | TIMBER RIDGE CAMP PANTRY | 1 | 89.99 | 89.99 | DDJ | WESTFIELD OUTDOOR INC | Camping Goods | ||
83 | 3800477 | 2622211 | 26 | SPORTING GOODS | CMT HIGHBACK CHAIR | 1 | 89.99 | 89.99 | DDC | CASCADE MOUNTAIN | Camping Goods | ||
cstSUM-3800477 |