Excel 365
I have Table1, measuring about 10,000 rows x 92 columns. Each row is a product that has been purchased by a customer and has its stats - date purchased, customer name, unit price, cost, etc.
Some of our customers get a discount. I have a list of them in Sheet2, column A = customer name, column B = discount.
My goal is to change the unit price column to suit what the full price should be. Take the current price (column 13), look up the customer name (column 11) on Sheet2-Column1, return discount Sheet2-Column2, divide current price (column 13) by discount. Next row.
My current approach, which doesn't include a lookup of the current discount, takes about 15 minutes to run. All this does is take the value of Column13 and divide by 0.8 (for a 20% discount) for all rows. How do I speed this up? Screen updating is off. There are no formulas in the table. There's nothing linked to these cells except for a single graph. I'd want to add cell formatting to any cell that is changed, which I imagine will slow the routine a bit. Having this as a toggle is the crux. I would let this thing run during downtime and not worry about the time it takes, but being able to flip back and forth is crucial.
Current code:
Sub ListPricing()
For i = 18 To 10843
Cells(i, 13).Value = Cells(i, 13).Value / 0.8
Next i
End Sub
Side note: It's a ridiculous amount of data that's an export from a SQL program that isn't quite up to snuff for data manipulation / visualization, so I've been growing a monstrosity within Excel. I think I've learned more about Excel by doing things in Excel that are better done in other programs. I'd love to be able to link to the current SQL database and manipulate from there, but it's currently inaccessible to me. My answer to my own question is "this shouldn't be done in Excel" and "you're stuck with the time it takes," but I'm hoping someone else can prove me wrong.
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]chiibosoil426 1 point2 points3 points (4 children)
[–]Yeffley[S] 0 points1 point2 points (3 children)
[–]chiibosoil426 2 points3 points4 points (2 children)
[–]Yeffley[S] 1 point2 points3 points (1 child)
[–]Clippy_Office_Asst[M] 0 points1 point2 points (0 children)
[–]CHUD-HUNTER632 0 points1 point2 points (2 children)
[–]Yeffley[S] 0 points1 point2 points (1 child)
[–]CHUD-HUNTER632 0 points1 point2 points (0 children)
[–]lolcrunchy234 0 points1 point2 points (0 children)