The Problem (Q-score 8, ranked #74th of 303 in the Excel VBA archive)
The scenario as originally posted in 2010
Also, would it be illadvised to use RExcel for corporate work? Also, what are some advantages / disadvantages of using it? How small do files need to be for Rexcel?
Why community consensus is tight on this one
Across 303 Excel VBA entries in the archive, the accepted answer here holds strong answer (top 25 %%) status — meaning voters are unusually aligned on the right fix.
The Verified Solution — strong answer (top 25 %%) (+16)
Verbal answer — walkthrough without a code block
Note: the verified answer is a prose walkthrough. If you need a runnable sample, check Excel VBA entries ranked in the top 10 of the same archive.
I have used it in the past, but am not currently using it. Here’s my personal list of pros/cons:
pro:
- easy access to R functions from Excel
- allows slipping some R logic into an existing Excel spreadsheet
- fairly easy to use syntax
con:
- In some instances it can be slow. If you have 5000 calls to R in a spreadsheet you can eat lunch while it refreshes
- to share a spreadsheet with RExcel embedded, the other users must have RExcel installed
- Sometimes the connection to R drops and you have to reconnect it
In my opinion RExcel can be a useful hack, but I would not make it a critical path along my workflow. If you really need one or two functions from R then RExcel can be a lifesaver.
I used RExcel to greatly speed up a very slow Excel spreadsheet by replacing a slow VBA function with a very fast one from R. This just bought me time so I could migrate the whole process to R which made it much easier to maintain and track.
I’m not sure what you’re asking when you asked “How small do files need to be for Rexcel?” RExcel is an Excel add-on, so if your data fits in Excel you can operate on it. Obviously if you get a huge Excel file in memory and try to send huge amounts of data to R which is also in memory you can run out of memory. But that’s a function of accessible memory, not really RExcel.
Loop-performance notes specific to this pattern
The loop in the answer iterates in process. On a 2026 Office build, setting Application.ScreenUpdating = False and Application.Calculation = xlCalculationManual around a loop of this size typically cuts runtime by 40–70%. Re-enable both in the Exit handler.
When to Use It — vintage (14+ years old, pre-2013)
Ranked #74th in its category — specialized fit
This pattern sits in the 95% tail relative to the top answer. Reach for it when your scenario closely matches the question title; otherwise browse the Excel VBA archive for a higher-consensus alternative.
What changed between 2010 and 2026
The answer is 16 years old. The Excel VBA object model has been stable across Office 2013, 2016, 2019, 2021, 365, and 2024/2026 LTSC, so the pattern still compiles. Changes that might affect you: 64-bit API declarations (use PtrSafe), blocked macros in downloaded files (Mark-of-the-Web), and the shift toward Office Scripts for web-first workflows.