Please help - formula query

TonyW1234

New Member
Joined
Jul 26, 2007
Messages
31
Hi all,

I currently have to display a large amount of data on a separate report. I have a master sheet which has columns and cells linked to another sheet, then a further sheet which has cells linked to the master sheet. The problem I am getting is when I link some of the date columns using a formula in the 3rd sheet, as this is looking at a cell that has another formula in on the other sheet it is displaying a date of 00/01/1900 if the value is zero, is there any easier way of getting the data to just display a blank as this is messing up the database it is being exported to.

Any help would be much appreciated.

Many thanks

Tony
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Tony,

It might suit to populate your 3rd sheet without using formulas at all. When working with data tables there is database-type functionality within Excel. Tables can be joined like in a relational database. This might then return you a true null (instead of zeros) and be better suited to loading to the database. For example, refer to 'external data' within Excel help, and the menu data, import external data, new database query, etc. External data can come from the same file, it doesn't have to be from a separate workbook.

HTH, Fazza
 
Upvote 0
Fazza, what's your preference if you are pulling data into an Excel file from another Excel file -- using Get External Data..., or writing an ADO procedure.

I am finding ADO so easy to use that I don't even want to bother with the MSQuery tools - but perhaps once you define a data source using Get External Data would also be quite fast to access repeatedly. Do you have any strong opinions here?

Regards.
 
Upvote 0
Hi, Alexander.

No strong opinions. Agree very much with your comments.

ADO and a little knowledge of SQL is great. A little VBA. Excellent for pulling data on the fly from mutliple workbooks/sources.

I guess it depends on what you're doing. The above is the main use for me. Something programmed and re-usable. I create the result each time.

I have limited use for a 'fixed' query table that can then be repeatedly updated. And there is the complication of changing references should source files change. I might use it in a one off task as it is easier to generate via the normal menu. I can edit the SQL in MS Query and get some powerful/handly results quickly. It is also easier to show someone, or to explain when answering forum posts. It doesn't need VBA. (As with this thread. I would use VBA & ADO to do the job however it is simpler to explain to others to use the MS Query interface.)

I think more verbosely than you eloquently expressed, I am agreeing with you.

For the benefits of others, ADO offers three main objects. For a single task the recordset object is simplest I find. A late bound example where strSQL is the SQL string and strConnection the connection string
Code:
dim objRS as object
set objRS = createobject("ADODB.Recordset")
objRS.open strSQL, strConnection
set objRS = nothing
I have a few instances of pulling data from dozens of files, creating the SQL in VBA. It still impresses me how quickly the data is pulled even when the SQL does something complex and maybe also has a subquery.

regards, Fazza
 
Upvote 0
Thanks for the response.
It still impresses me how quickly the data is pulled
I am rather new to ADO and I am in awe - its a real thrill to see my blank worksheet suddenly bursting with data, with only a few lines of code to make it happen. :) But I also find the query tools to be a very convenient way to show my coworkers what a SQL query is like. Primarily, I've used ADO with Access databases -- I will have to play with some Excel-to-Excel connections.

Regards.
 
Upvote 0
Only difference Excel-Excel v Access-Excel is the connection string. So, that will be trivial for you.

With a little ADOX you can create an .mdb file on the fly. I did a neat little test recently and with a relatively few lines of code created an .mdb file with new table (ADOX) and then (ADO) pulled data from mulitple Excel files into the new file. As I late bound, this could be run from 'anywhere'. So, even without Excel or Access even being loaded on the machine, the code ran fine from VBA in MS Outlook or MS Word. Another bit of magic - no Excel, no Access and a new mdb file is created from multiple Excel files! ;)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,694
Messages
6,126,252
Members
449,305
Latest member
Dalyb2

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