Use Access as a backend database for Excel

gaurav_madhwal

New Member
Joined
Jan 4, 2013
Messages
4
I am working on a spreadsheet which is growing in terms of size everyweek, currently it is about 30 MB.

So I want to use Access as a Database for this Excel Sheet.

Here is the situation.

1 excel sheet with 3-4 tabs + 1 Master Tab. Master Tab has formulas (lots of them) which spits the values calculating from these other tabs (which I need to update everyweek).

Idea is to get rid of those tabs and put in access and then using access as a backend database to calculate the values in master tab of my spreadsheet and thus reducing the size of excel sheet.

Please let me know if I am not clear in terms of explaining my problem.

Any help will be highly appreciated.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You can link to the data in Access via the Data Tab ('From Access'). This will set up a table on a tab of your choice - so you won't be able to get rid of the tabs. The calculations would still be done in Excel. The data will then refresh at will from the Access database.

However, I'll be honest I don't know what performance increase you'll see, if any. The major (potential) advantage would be that a number of people could be working on the data at the some time.

Depending on how much data you're talking about you might see some performance increase by setting up queries in Access and pulling the data from them, which might reduce the amount of data transferred. But if you need all the data to do the calculations on, then this won't help.

Hope this garbled stream-of-conciousness helps a little.

Regards
Adam
 
Upvote 0
You can link to the data in Access via the Data Tab ('From Access'). This will set up a table on a tab of your choice - so you won't be able to get rid of the tabs. The calculations would still be done in Excel. The data will then refresh at will from the Access database.

However, I'll be honest I don't know what performance increase you'll see, if any. The major (potential) advantage would be that a number of people could be working on the data at the some time.

Depending on how much data you're talking about you might see some performance increase by setting up queries in Access and pulling the data from them, which might reduce the amount of data transferred. But if you need all the data to do the calculations on, then this won't help.

Hope this garbled stream-of-conciousness helps a little.

Regards
Adam



Thanks for the quick reply..

So you are suggesting that I cannot actually populate a result by executing a formula in my master tab in excel which references the DB table in access to pull information??

Because I looked and actually came across a method to do a VLookup from access database in excel spreadsheet but it is a very tedious process which includes writing a VBA along with the formula and changing refrences for active X.

But I got lot of multiple formulas within one formula + mutiple criteria's, so I am kind of confused.

I was hoping I could get rid of data tabs from which I am pulling information from and form a database for those in Access


Thanks
Gaurav M.
 
Upvote 0
I'd never presume to say something wasn't possible! But I'm not sure it's worth the effort, and given the complexity it may cause more problems than it solves. Really a more thorough response would depend on exactly what formulae you're using, and what output you need. If it's a lot of VLOOKUPs then some SQL JOINs may do the job. If you're summing/counting then again, there are SQL statements you can use. In both of these instances you may see some performance increase by allowing Access to execute built-in queries. However, if your Excel functions are more complex and need to work on all the data or a significant subset thereof, then I'm not sure you'll see any gain.

Perhaps some sample data and some more clarity on the required output may help?

Regards
Adam
 
Upvote 0
I'd never presume to say something wasn't possible! But I'm not sure it's worth the effort, and given the complexity it may cause more problems than it solves. Really a more thorough response would depend on exactly what formulae you're using, and what output you need. If it's a lot of VLOOKUPs then some SQL JOINs may do the job. If you're summing/counting then again, there are SQL statements you can use. In both of these instances you may see some performance increase by allowing Access to execute built-in queries. However, if your Excel functions are more complex and need to work on all the data or a significant subset thereof, then I'm not sure you'll see any gain.

Perhaps some sample data and some more clarity on the required output may help?

Regards
Adam



I can't give you the data sample because of confidentality issue but If you can give me steps or procedure or something that allows me to link access and excel together, I will try to run query myself..

Give me a small example, if you can
 
Upvote 0
I do this all the time. Its fairly easy but you need to give a little more info on how you want to pull the data. Is is based on a query? How I handle it is, I run a parameter query from excel to fetch the new data, I put it on a temporary sheet where it updates my calculations, in this case I assume its your master tab. Then print reports etc., then when you reload new data I simply clear the old temp data and the cycle repeats. Super easy and super powerful. Nothing beats the power of excel calculations backed up from a ton of data from a database.
To summarize, use access to store the data and excel to do the calculations. You can do calcs in access but why if you have the option to use excel.
I cant tell you how many people I see trying to store data in excel spreadsheets and then trying to make excel work like a db with 60000 records and vice versa trying to do calcs in access. Theyre both great tools and even greater when used together.
 
Last edited:
Upvote 0
I do this all the time. Its fairly easy but you need to give a little more info on how you want to pull the data. Is is based on a query? How I handle it is, I run a parameter query from excel to fetch the new data, I put it on a temporary sheet where it updates my calculations, in this case I assume its your master tab. Then print reports etc., then when you reload new data I simply clear the old temp data and the cycle repeats. Super easy and super powerful. Nothing beats the power of excel calculations backed up from a ton of data from a database.
To summarize, use access to store the data and excel to do the calculations. You can do calcs in access but why if you have the option to use excel.
I cant tell you how many people I see trying to store data in excel spreadsheets and then trying to make excel work like a db with 60000 records and vice versa trying to do calcs in access. Theyre both great tools and even greater when used together.


OMG if this is so easy possible you will make my life at work so easy..

So here is the situation

1 Master Tab uses formulas to pull information from my other data tabs
For instance in my master tab in one cell of a particular column I manually fill in the Package Number and in it returns the description of the package from one of the data tabs (result of a little complicated mixture of few formulas)
Also for that very same package another formula gives me a unit of work done for one particular week ending date. (this is a sumif formula with various criteria involved)

So there are three different kind of work packages I need info from, which concludes three different data tabs.
Also for that same work package I also calculate remaining hours of work and budget assisned to that package from my data tabs.

These data tabs are generated from a progressing software and updated weekly, just a simple copy paste under the headers.

I hope it makes sense, I really can't give you my sample sheet due to the confidentality,but I will try to make a replica If i can.

Let me know if you need more details
 
Upvote 0
Yep it makes perfect sense. I understand you cant send your spreadsheet due to proprietary information. I am in the same situation. So, here is what you need to do. I assumed you would be using .mdb access file format and we will use the package number as the parameter for example purposes. You can apply this logic to any of the three tabs of data. We will stick with one for example. Once you get this to work you will see how you can apply this to multiple situations to make your life easier.
Step 1.
Make your database and put the data you are currently storing on those three tabs in excel into access data tables. For ease of explanation you can simply make the access tables identical to your excel data tabs. (or not up to you) Record your database name and database file location path for reference at step 3.
Step 2.
Make a parameter query in access to pull the data you normally would pull from one of the sheets using your package number as the parameter. Run the query manually and enter a known package number and ensure it pulls data. If it does, record your query name for the next step. If not stop and fix your query until it does.
Step 3.
In your excel main/master page add a command button next to where your package number is entered and attach the following code to it. You will need to modify the spots Ive indicated with your information above.

Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
'step 1 declare variables
Dim MyDatabase As DAO.Database
Dim MyQueryDef As DAO.QueryDef
Dim MyRecordset As DAO.Recordset
Dim i As Integer
'step 2 open database
Set MyDatabase = DBEngine.OpenDatabase _
("C:\yourdatafolderhere\youraccessdbhere.mdb")
Set MyQueryDef = MyDatabase.QueryDefs("yourquerynamehere")
 
'step 3 paramter value for your query  (I assume this is the sheet and cell where your package number is entered.
With MyQueryDef
.Parameters("[Enter]") = ThisWorkbook.Sheets("yoursheettabhere").Range("yourreferencecellhere").Value
End With
 
Set MyRecordset = MyQueryDef.OpenRecordset
 
'Step 4: Clear previous contents - This is one of your 3 sheet tabs where you would normally store your data.
ThisWorkbook.Sheets("yoursheettab1").Select
'enter the entire range of where your data is below
Range("A1:bqq10000").ClearContents
 
'Step 5: Copy the recordset to Excel.  Row 2 is where the data will be placed
ActiveSheet.Range("A2").CopyFromRecordset MyRecordset
 
'Step 6:Puts the database data headers in
For i = 1 To MyRecordset.Fields.Count
ActiveSheet.Cells(1, i).Value = MyRecordset.Fields(i - 1).Name
Next i
Application.ScreenUpdating = True
'homes your spreadheet - remove if not needed or select any page you want to select when code is done running
ThisWorkbook.Sheets("yourmainpgetabhere").Select
Range("$a$1").Select
MsgBox "package data completed"
End Sub

Step 4.
Enter your package number into your cell as you normally do and click the command button. This will query the database for your package number information and place it on the page you indicated in the code above.

Step 5.
You can now change your vlookups on your master page to simply look at the data you just newly queried and entered into excel and everytime you change the package number and re-run your data on your master page will update.

Step 6.
Apply the same logic to your other two pages of data you need. (you can also add more parameters into the same query and even possibly grab the data for all three tabs with one click.)

Thats it! Seems complicated at first but once you figure it out you will use it all the time. - good luck!

P.S. - if you have your package numbers already in the database you can also query the database for distinct package numbers and populate a combobox. Then all you need to do is use the pulldown to get the package number and hit run. But get the above working first before you try doing this.
 
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,952
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top