BobTheSpreadsheetBuilder
New Member
- Joined
- Nov 23, 2023
- Messages
- 10
- Office Version
- 2016
- Platform
- Windows
Hi
I am wondering if anybody knows how to replace a grid of formulas with a VBA script ?
I am very familiar using formulas along with VB to obtain results in my spreadsheets. In my current project I
am using a grid of formulas in 20 columns x 20,000 rows to locate and extract data in the data sheet.
It is effectively a complex Search function, with 20 search cells, for up to 20 words at a time.
A typical use case is: you can place a novel with up to 20,000 lines of text in the data sheet. You can enter up
to 20 search words: each word has its own column to Search for that word in each Row.
There is a 21st column that has a formula that equals 1 if the other 20 columns on that row contain a result .
My VB script acts on the 21st column only, looping through the 20k rows, and where it finds a 1, copies the whole row to a Results sheet.
The problem is, while the VB scripts in my project are ~30 KB, the table of 20 x 20,000 formulas add ~15MB to the file size.
I had considered incorporating the formula into the VB script using Application.WorksheetFunction , however that might seriously slow down the script. The formula is long, 2x screen widths of the standard formula Bar and took weeks to construct. Currenltly, Excel natively updates the formula table in about ~10 seconds on first opening, and the VB loops on the 20,000 cells in Col 21 in ~3 seconds.
(The Data table has Range ("A11:A20010") : Search words are in a Range ("A1:T1")
Does anyone know if there's a way, possibly adding the 20 search words to an Array, to quickly check for matches in 20,000 lines, each line containing up to ~100 words, like comparing 2 arrays ? I'm not very familiar with manipulating Arrays. i read somewhere about Intersection or Union of 2 arrays but unsure if its applicable.
My current formulation was slow to set up, however it is methodical and I could progress stepwise over many evenings in a logical fashion. I feel my approach is clunky and old fashioned and I am missing out on a more agile way of getting results and shrinking my file size.
Could someone demonstrate a small example for say a 20 x 20 data table ?
Thanks for any advice on this problem
Rob
I am wondering if anybody knows how to replace a grid of formulas with a VBA script ?
I am very familiar using formulas along with VB to obtain results in my spreadsheets. In my current project I
am using a grid of formulas in 20 columns x 20,000 rows to locate and extract data in the data sheet.
It is effectively a complex Search function, with 20 search cells, for up to 20 words at a time.
A typical use case is: you can place a novel with up to 20,000 lines of text in the data sheet. You can enter up
to 20 search words: each word has its own column to Search for that word in each Row.
There is a 21st column that has a formula that equals 1 if the other 20 columns on that row contain a result .
My VB script acts on the 21st column only, looping through the 20k rows, and where it finds a 1, copies the whole row to a Results sheet.
The problem is, while the VB scripts in my project are ~30 KB, the table of 20 x 20,000 formulas add ~15MB to the file size.
I had considered incorporating the formula into the VB script using Application.WorksheetFunction , however that might seriously slow down the script. The formula is long, 2x screen widths of the standard formula Bar and took weeks to construct. Currenltly, Excel natively updates the formula table in about ~10 seconds on first opening, and the VB loops on the 20,000 cells in Col 21 in ~3 seconds.
(The Data table has Range ("A11:A20010") : Search words are in a Range ("A1:T1")
Does anyone know if there's a way, possibly adding the 20 search words to an Array, to quickly check for matches in 20,000 lines, each line containing up to ~100 words, like comparing 2 arrays ? I'm not very familiar with manipulating Arrays. i read somewhere about Intersection or Union of 2 arrays but unsure if its applicable.
My current formulation was slow to set up, however it is methodical and I could progress stepwise over many evenings in a logical fashion. I feel my approach is clunky and old fashioned and I am missing out on a more agile way of getting results and shrinking my file size.
Could someone demonstrate a small example for say a 20 x 20 data table ?
Thanks for any advice on this problem
Rob