473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Excel 2003 Pulling data according to date

Morning all!

Okay so here's the situation... I have employees that have had rate changes during a job and if I edit the information and run a report for a previous week ending date the payrate is wrong (obviously because I changed it) and what I need to be able to do is list the person's name and rate i.e.
Name ST RATE OT RATE
John Smith 25.00 37.50 This is before the rate change

John Smith 30.00 45.00 After rate change

What I was thinking is that I could place a couple columns with a range of dates and then if the week ending date falls within that window it'll pull the current rate as opposed to the previous rate. I've tried a few things and it doesn't seem to want to recognize the dates and it especially doesn't like an open date. Can someone help me out on this? It's kicking my butt...

I attached an example. Please note that the two rows at the end of the table are just me trying to figure out how to do it and in no way required. The part below the week ending date is just a copy of what I need pulled.

Thanks,

Bill Sublette
Attached Files
File Type: zip example.zip (3.2 KB, 129 views)
Mar 16 '11 #1
9 2190
NeoPa
32,556 Expert Mod 16PB
Unless I'm much mistaken Bill, this is a case of redesigning your data rather than looking at your logic.

If I understand the situation correctly (and I don't look at databases for the question. I expect everything relevant to be laid out clearly in the post.) then you are not storing dates with the rates. Without such data, any handling of this issue is likely to be a fudge. Fudges can sometimes work, but they don't often, and they're never good for building on going forward.

Does that make sense?
Mar 20 '11 #2
I have their start date saved in the database. All I have to do is add another column with the rate change date. The big issue is having it pull the correct data within the database according to my selected Week Ending date. The example is miniscule compaired to my real database (over 12Mb file) as it has over 4k entries per week.
Mar 25 '11 #3
NeoPa
32,556 Expert Mod 16PB
If I'm even going to look at this Bill I will need more details posted in the thread. What is in the post is not going to enable me to give you any help beyond what I've already posted.
Mar 25 '11 #4
Oh okay. What I need to be able to do is pull a person's rate according to the selected week ending date which is on a separate tab. When the date is selected I need it to pull their current rate, the hours worked during that week (including the days) and then where they worked and the quantities (if applicable) that were completed during that date. A person's rate can change for several reasons but tracking it is the important thing. It then needs to total the hours worked per person including the person's Overtime (OT) and any/all per diem associated with that employee. I have it now where it'll pull all the required information except the rate change information. I'll attach the current working file that will show you better what I am talking about. The "Daily Time Report" tab is where the rates are being pulled in. The "Direct (2)" tab is where I am pulling the rate and all the other data is being pulled from the "Master" tab. Thanks in advance for taking a look at it.

Thanks,

Bill Sublette
Attached Files
File Type: zip Copy of Master 6-6-10 thru 1-23-11_v1.1.zip (515.4 KB, 104 views)
Mar 25 '11 #5
MMcCarthy
14,534 Expert Mod 8TB
I think you misunderstood the original point NeoPa was trying to make.

What you are trying to do requires a different structural approach to the database. You can't just add columns to your existing table to handle this you need whats normally called a transactional table. A transactional table basically handles the history of a value that changes for a record. A sample structure that works along these lines is laid out below to show you what I mean.

tblEmployee
EmployeeID (Primary Key)
EmpName
StartDate

tblRateOfPay
RateOfPayID (Primary Key)
EmployeeID (Foreign key to tblEmployee)
PayRateDate
PayRate

tblHoursWorked
HoursWorkedID (Primary Key)
EmployeeID (Foreign key to tblEmployee)
WeekEndDate
NoHoursWorked

This structure allows you to reference any employee using their EmployeeID and reference the Payrate based off a particular date. Sample queries would be something like the following:

Expand|Select|Wrap|Line Numbers
  1. SELECT tblEmployee.EmployeeID, tblEmployee.EmpName, tblHoursWorked.WeekEndDate, tblHoursWorked.HoursWorked, tblPayRate.PayRateDate, tblPayRate.PayRate
  2. FROM (tblEmployee INNER JOIN tblHoursWorked ON tblEmployee.EmployeeID = tblHoursWorked.EmpoyeeID) INNER JOIN tblPayRate ON tblEmployee.EmployeeID = tblPayRate.EmployeeID
  3. WHERE (((tblPayRate.PayRateDate)<[tblHoursWorked]![WeekEndDate]));
  4.  
  5. SELECT Query1.EmployeeID, Query1.EmpName, Query1.WeekEndDate, Query1.HoursWorked, Last(Query1.PayRate) AS LastOfPayRate, Max(Query1.PayRateDate) AS MaxOfPayRateDate
  6. FROM Query1
  7. GROUP BY Query1.EmployeeID, Query1.EmpName, Query1.WeekEndDate, Query1.HoursWorked;
  8.  
There are nicer ways of doing this if I had time to think about it but I'm just trying to show you the logic right now.
Apr 1 '11 #6
And that would work beautifully if I weren't doing this in Excel. Unfortunately I'm stuck with using Excel... And that's the biggest problem I have... I explaied to my Site Manager that all of this would be so much easier in Access, but for some reason he's still resistant.
Apr 1 '11 #7
MMcCarthy
14,534 Expert Mod 8TB
:) That will teach me to read the question title. It's probably a good idea to mention something like this in the post as well as it helps people like me who are too lazy to read the title.

You can't do this logic with a flat table of records. You could use a different sheet to represent each table.

Since I would never do something like this in Excel I can't think of how to approach it right now and honestly don't have to time to give it proper consideration. The only thing I can think of is a sheet with all employees in column A as row tags and in row 1 put column tag headers for each weekending date for the year. Then fill in the values something like the following:



NeoPa may have some ideas but you really need to get accross to your boss that Excel was never designed to work as a database.
Attached Images
File Type: jpg excelsample.jpg (33.9 KB, 347 views)
Apr 1 '11 #8
Rabbit
12,516 Expert Mod 8TB
If you have the start date and end date, then for any input date, you can find the row(s) where that date is larger than or equal to the start date AND that date is less than or equal to the end date. If true, you could say, print out the name of the employee or their ID. Then you could use the various lookup or match functions in excel to get the row and use that to find the rate.
Apr 1 '11 #9
NeoPa
32,556 Expert Mod 16PB
Like Mary I missed the part where it said it was all supposed to be done in Excel. I'm sure you've already explained to your boss that such facilities are designed into Access (an RDBMS) whereas Excel is not remotely designed to handle such niceties. Nevertheless I will say it again in case a third-party expert carries more weight with them.

Bill's right. This really isn't something Excel is designed to handle and, though it is not impossible (Rabbit's references to the VLookup() etc functions might need to be called heavily.), it is a serious headache and not to be undertaken without appreciation of the problems that will result.
Apr 2 '11 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Norma | last post by:
I am trying to make a query pull data from between the dates I enter in the parameter but also look back 'in time' to see where 2 other fields have null values, and only pull data into the query if...
1
by: cybertof | last post by:
Hello, Is there a way to connect (through automation) a c# application to a running Excel 2003 instance on a specific workbook ? In the past, i used to use GetObject(...) function in VB6. ...
3
by: Rik Moed | last post by:
Hi, I am having a problem with Excel 2003 worksheets when I upload them using the HtmlIputFile. After the upload, I start to download the worksheet and it appears to be currupt. I recieve the...
3
by: Eliézer Madeira de Campos | last post by:
I'm trying to use VB.NET to read an Excel 2003 file, so to process its data and eventually store (some of) it into a SQL Server 2000 database. However, I'm not quite understanding Office/Excel 2003...
2
by: Nicholas Dreyer | last post by:
The following error Run-time exception thrown : System.Runtime.InteropServices.COMException - Error loading type library/DLL. happens while running the code listed at the bottom of this...
0
by: Fendi Baba | last post by:
I created an ASP.net page which opens excel. This works fine in Office 2007. However, Excel 2003 runs in an error which states "cannot read output file". Hee is the VB code and below is the ASPX...
0
by: sandervanee | last post by:
Hello, I am trying to export several Access 2003 select queries to Excel 2003 using an Access macro. I'm using the macro command "TransferSpreadsheet" to export the queries. This going quit well,...
15
by: =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= | last post by:
Hi All, We are in the process of Upgrade Excel 2003 (Office 2003) to Excel 2007 (Office 2007) for one of web application. This web application is using Excel (Pivot Table) reports. With Excel...
4
by: hall.jeff | last post by:
There's a government website which shows public data for banks. We'd like to pull the data down programmatically but the data is "hidden" behind .aspx... Is there anyway in Python to hook in...
4
by: =?Utf-8?B?THluZXJz?= | last post by:
Hello All, We have a VB.NET application writen using VS 2003. This application apens an excel file from a vendor, reads the data and performs whatever functions it needs. We recently upgraded our...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.