You are here:

Excel/Updating spreadsheet

Advertisement


Question
Hi Bill

I am trying to put together a spreadsheet that imports and updates data daily from a database.  I have no problems in writing the query to import the data and it is set to update automatically every hour and when the spreadsheet is opened.

However, the problem I have is that I only want to display data from the last 30 days. What I would like to be able to do as soon as a new point is entered in to the spreadsheet all the data associated with the oldest data point i.e. that from 30 days ago is automatically deleted as the relevant data is from the last month.
The format of the data is
column 1 Date, column 2 Data Value.
The date format is dd/mm/yyyy time
I have reasonable basic knowledge of Excel but limited experience with macros.  Any advice would be much appreciated.

Thanks

Phil

Answer
Phil,

  There is no excel function or equation that I can think of which will delete a row from a database, or which will erase data from a row. I can think of several ways to HIDE such data, but the only non-macro way to delete it is to manually, not automatically, do it.

  I don't do macros, as my profile  says, so if you are convinced you need a macro for this, then you'll need to go to another expert.

  I can think of several ways to get the data you want onto a sheet, though, but you specifically mentioned macros so maybe you don't want equations.  

  The way I have in mind, very briefly, would be to bring all your data into a big database.  In Excel 2003, you can allow this database to have 65,536 rows if needed!

  Then you can apply an ADVANCED FILTER to the database, with the criterion set to select only rows whose data is within 30 days of today's date.  Copy the selected records to another spot (instead of using 'filter in-place').  This isn't quite 'automatic', although if you are using a macro to import the data, you could simply add these advanced-filter commands to that macro.

  Instead of the ADVANCED FILER, which requires macro commands or manual menu-driven operations, you could (possibly) create a swath of DGET functions to extract the various records from the master database onto another sheet.  I'd have to give that a little more thought, and also would have to know what makes each record unique (other than the variable data within it; for example, does each row have a different, but predictable, date?)

  There's probably some other equation-type techniques which could be used also, but this is what comes to mind for now.

  Other than asking Tom, on this site, about macros, because that's his specialty, and not mine.

   >>> Bill
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

All Answers

Answers by Expert:


Ask Experts

Volunteer


Bill Hermanson

Expertise

Please tell me WHICH EXCEL VERSION you are using!

DO NOT ASK ME me about Macros or VBA.

Please read my "instructions to questioners" in my full profile [use View Profile, at right], to help you write a question that I can understand, without having to ask you what you mean.

If your question contains any of the words THIS, IT, THAT, THOSE, or THEY, I likely won't understand IT. Please rewrite!

My Expertise: I am an expert at data manipulation, the use of incredibly complex logical statements, databases, combining tables and extracting data, all the LOGICAL, LOOKUP & REFERENCE functions, dynamic ranges, creating professional appearing spreadsheets, complex functions, integrated charts and visual displays, user interfaces.... I can make Excel do anything!

But PLEASE... NO MACRO or VBA QUESTIONS!

Experience

25 years development of complex spreadsheets for personal and professional use. I've developed hundreds (or thousands!) of spreadsheets in all fields, from complex engineering calculations to game scoring, financial analysis, scheduling, cost-of-doing-business, and analysis of home energy use. I even used Excel to assist in design of the flight computers presently on board the Hubble Space Telescope (1984-1991)

Education/Credentials
BSEE Electrical Engineering, CU Boulder CO USA
Use of spreadsheets since 1982
Boulder Valley School District, Life Long Learning, Instructor
Owner & Operator of Excel Expert, LLC

©2009 About.com, a part of The New York Times Company. All rights reserved.