VBA To Find A Date
Mar 5, 2008
I'm looking for some quick code (probably a function) where I can pass it today's date and it returns the next fridays date...
eg if i ran it today 03/05/08 then i would expect it to return 03/07/08
if i run it on 03/07/08 i would also expect it to return 03/07/08
and if i ran it on 03/08/08 i would expect it to return 03/14/08
View 9 Replies
ADVERTISEMENT
Mar 28, 2014
I'm trying to combine the hours that a employee worked on a single date, with one of multiple time periods that exist for that employee.
I have two sets of data.
Set 1 (hours)
Employee number, date, hours
12345, 1-2-2014, 6
12345, 1-3-2014, 8
12345, 1-10-2014, 8
Set 2 (periods)
Employee number, start date, end date
12345, 1-1-2014, 4-1-2014
12345, 6-1-2014, 1-2-2014
What I'd like to do is to add the start and end date of Set 2 to Set 1 for every row in Set 1
In above example the result should be like this.
12345, 1-2-2014, 6, 1-1-2014, 4-1-2014
12345, 1-2-2014, 8, 1-1-2014, 4-1-2014
12345, 1-10-2014, 8, 6-1-2014, 1-2-2014
View 13 Replies
View Related
Mar 4, 2013
I have collected some data on economic factors for different countries. Unfortunately, the dates when I started to calculated my economic factors are different for each country (due to the data available to me).
What I would like Excel to have done is to take the date when I started to measure for e.g. country A (D3 ie 30/06/2007), copy it into column "I" (for country A, it's cell I3) and fill in the following months in the rows below (with always the date of the last day of a month) until it reaches 28th of Feb 2013. Then, it should go up to the next country (country B) take the starting date (D4, ie 31/07/2007), go to the last entry in "I" (ie I71) and paste the date in, fill in the months until 28th of Feb 2013, do the same for country C and so on.
I have started to code a VBA but I am unfortunately a beginner in VBA and totally stuck at the moment. My VBA code does paste in the months but for some reason, it also changes the starting date of the first month.
Moreover, I tried a workaround for the fact that Excel doesnt know when to stop; ie I introduced a "monthdiff" variable which should calculate the number of months between the starting date (which is variable and unique for each country) and the end date (which is always 28th of Feb 2013). At the moment, it only does this for country A.
VB:
Set rng = ActiveSheet.Range("I3" & Cells(monthdiff, "I").Address)[SIZE=4][/SIZE]
I have tried to make this dynamic but have been unsuccessful so far.
Spreadsheet with data&code is attached.
VB:
Sub Macro1()
Dim mainrange As Range
Dim rng As Range
[Code].....
View 3 Replies
View Related
Feb 17, 2014
If a sale was made between 2/09/2014 - 2/15/2014 return the date of the following weeks Friday. In this case 02/21/2014.
View 3 Replies
View Related
Dec 12, 2011
way to search and display a date from a range of cells based on less than or greater than criteria. For example I have following dates in column A:
A1: 2011/01/04
A2: 2011/02/01
A3: 2011/03/01
A4: 2011/04/01
I want to search for the date which is less than 2011/02/01 from the A column and display that date in B1 cell for example. How do I do that?
I want to do this without using any macros.
View 9 Replies
View Related
May 22, 2014
I need a formula thet will look at the last date of the absence and calculate what would be the last working date in the given financial yaer.
Example
Abcence Start Date 21/08/13
Abcence Due End Date 04/11/14
Financial Year Start Date 01/07/13
Financial Year End Date 30/06/14
View 13 Replies
View Related
Jul 30, 2007
This is a sub that uses the Find method to find a series of dates and copy them to another worksheet. The following error comes up: Object variable or With block variable not set. I have tried using a set command etc. but other errors end up coming up.
Private Sub CommandButton7_Click()
On Error Goto errorHandler
Dim startDate As String
Dim stopDate As String
Dim startRow As Integer
Dim stopRow As Integer
startDate = InputBox("Enter the Start Date: (mm/dd/yy)")
If startDate = "" Then End
stopDate = InputBox("Enter the Stop Date: (mm/dd/yy)")
If stopDate = "" Then End
'startDate = Format(startDate, "mm/??/yy")
'stopDate = Format(stopDate, "mm/??/yy")
startRow = Me.Columns("A").Find(startDate, _
LookIn:=xlValues, lookat:=xlWhole).Row
stopRow = Me.Columns("A").Find(stopDate, _
LookIn:=xlValues, lookat:=xlWhole).Row
Me. Range("A" & startRow & ":A" & stopRow).Copy _
Destination:=Worksheets("Report").Range("A1")
End
errorHandler:
MsgBox "There has been an error: " & Error() & Chr(13) _
& "Ending Sub.......Please try again", 48
End Sub
View 9 Replies
View Related
Jan 29, 2010
What I have is the project name's in B5, B6.....B117
In C5 I have a start Date of the project
D5 Calculates the if it is over or under time.
I only enter dates in the (red Accent 2 80%) what i call a pinkish colour.
Now it seems to work if the dates flow from one cell to the next.
What I need is to work out a way to allow any part of the project to be completed (Could be at the end or middle) and it not give error and work correctly. I need it to basically look for dates entered and grab the date that is equal to the date entered in that row series or the next date down....
View 9 Replies
View Related
Aug 13, 2009
1 column in my sheet is a list of dates (affectively a calendar). I am trying to create a macro that will only display rows 1-5 and then current the current date and the next 30 days and hide all other rows.
The approach I have tried is to use “ADDRESS(MATCH(BS40,$B$1:$B$462,0),2)” equation to find the cell with todays date in it (Cell BS40 contains todays date). This was repeated for todays date +30. The problem I have is that although I now have the cell address’s located I cannot reference their values in a range.select
What I want to do is somwthing like this:
View 2 Replies
View Related
Dec 10, 2008
I've been trying various INDEX/MATCH combinations, but currently no joy. On one sheet ('Overview') I have a row with a number of dates in the cells (B4:H4). Each column has a project stage title (B3:H3).
On another ('Detail') I want Excel to look at a date and find which project stage this is part of. For example, in 'Detail' I might have the date 1/12/2008. On the 'Overview' page this date might fall under the 'Send Drawings To Contractor' stage, even though this stage begins on 15/11/2008. and the next stage begins 10/12/2008. I've attached an example of the sheet I'm putting together - hope it makes things clearer.
View 3 Replies
View Related
Jun 1, 2009
I am trying to find a date
I have a date in cell A1.
and a list of dates (in chronological) from Cell C1 to C999
How can i ask excel to copy the date in A1, and search for the dates from C1 to C999, and move to the cell that the exact date is.
Using excel's default search seems to be problematic
View 14 Replies
View Related
May 26, 2013
[URL]
how to find the max date of a value in column A. From there I need to link up the price associated with that date. VBA is preferred. The information I'm working with is structured like this in this image:
MaxDate.jpg
What I want to do using VBA, is to look at the values in column A and for each of them, find the max date or most recent date. Once that is determined, on a new sheet, I want to write the value found in column A in sheet2/ColumnA and the date in column B, and the price in column C. In a nutshell, I'm looking for an effective date for pricing. The example on the bottom is basically what I'd like to extract with code onto another sheet.
View 6 Replies
View Related
Jan 20, 2014
I'm trying to find a formula that can be input in the yellow cells shown, which automatically searches for the last date seen/entered for that particular client. I wish to be able to sort Column A and look for all client's seen in say "January" and it show the last date the client was seen that year. Hopefully the example will be clear.
match dates.xlsx‎
View 2 Replies
View Related
Sep 8, 2009
I have a table that shows across the top row date headings for year and month. So it would show like this, 2008/01 2008/02 2008/03 2008/04 etc to year ending 2009/12
I need a formula which will tell me the first date that a customer started transacting. Under each date heading is a count of transactions for each year/month by each customer. So, I need to search for the very first transaction number and return the date.
View 2 Replies
View Related
Sep 28, 2009
I have a number of tables that may or may not have multiple dupliate enters, I am trying to indentify by name and by date. None of the tables are in the same format, which makes it ever harder for me, but all I want is a return of "duplicate" or "original", this will allow me to have acloser look at the duplicates.
View 7 Replies
View Related
Nov 21, 2013
I want to find greater date among two.
I tried
=If(a1 < B5,1,0)
But problem is my date in B5 itself comes from other formula.
=right(X1,9)
View 6 Replies
View Related
Nov 20, 2008
I have a spreadsheet with a data sheet and a second sheet. On the second sheet I want to look up the value from A2 and find the highest date associated with this value in the data sheet.
This will be used to look at a number of projects that have multiple dates, and I want the latest date i.e. the furthest into the future. To add a spanner to the works, some dates are recorded as N/A so I obviously want to ignore these. I have attached an example workbook if anyone has a couple of minutes to take a look.
View 3 Replies
View Related
Feb 25, 2009
I have two columns in a table; Plan and Date.
Plan Date
A 01/02/03
B 12/08/05
C 02/04/06
C 06/04/07
C 06/04/07
Now I want the third column, also a date, so that it returns the earliest date for the repeating plan type.
Plan Date New Date
A 01/02/03 01/02/03
B 12/08/05 12/08/05
C 02/04/06 02/04/06
C 06/04/07 02/04/06
C 06/04/07 02/04/06
View 14 Replies
View Related
Feb 20, 2010
I have a table which, across the top, has different cell titles, say "Category" in A1, "Budget" in B1, and C1 through F1 are date values. I need a formula which will return "C1", because it's the left-most cell in the first row which contains a date.
I know I can find a date with ISNUMBER or the TYPE functions. But I cannot get TYPE to work on an array. Honestly, I can't even understand the behavior of TYPE. Let's say B1 contains a string, and B2:B8 contain numbers.
If I select one cell and do TYPE(B1:B8) and press enter, I get "2", because B1 contains text. If I change B1 to a number, the TYPE cell returns "16", which means error. Wha....?
If I instead press CTRL+SHIFT+ENTER on the TYPE cell, I get "64", which is the array type. So obviously this is not doing what I want it to do (which is to run the function TYPE on each of the cells B1 through B8). With ISNUMBER, I can get the array functionality, but I want to find the *first* numerical cell, not if each cell is a number.
View 5 Replies
View Related
Oct 22, 2012
01-Oct-12
02-Oct-12
03-Oct-12
04-Oct-12
05-Oct-12
10
212
23
24
58
Here the maximum value is 212, Is there any way to find its corresponding date. Date in Row(A1:A5), Values in Row(B1:B5). Tried my best to get the date; but no way.
View 4 Replies
View Related
Feb 5, 2014
I have Dates as column headings, People going down across rows, and their corresponding budgeted hours:
Person Last Day 1/1 1/8 1/15
Bob ? 45 45 0
John ? 45 0 0
I need a formula in the "Last Day" column that can pick up when a person rolls off the project, i.e. has a value of "0" or "-".
I need this because I have a spreadsheet with thousands of resources and don't want to comb through, manually looking for their last day on the project.
View 3 Replies
View Related
Jan 15, 2008
I need a formula that will look up to find a specified date on another worksheet, and input the data in the cell that is 4 columns to the left of it. Can this be done?
View 9 Replies
View Related
Jun 15, 2009
I have a cell that contains text,but somewhere in it there is always a date, the text is updated wit web query and the date is always in a diffferent position within the text, I want to take the date out each time and drop it to another cell.
View 9 Replies
View Related
Aug 1, 2009
Need to convert price on transactions throughout the year to different currencies - using historic currency exchange rates.
Entered data in columns A-D:
Date1 | Value1 | Date2 | Value2 |
Required Formula to generate column E for each row individually (to 2dp using d/m/y format):
Value1xValue2whereDate1=Date2
Date1/Value1 will be prices on certain dates while Date2/Value2 will be historic exchange rates for every day of the year.
View 9 Replies
View Related
May 19, 2006
if I have 2 dates 21/05/2006 and 23/05/2006, how can I find out if 22/05/2006 exists between them
View 4 Replies
View Related
Dec 21, 2006
I have a row of dates, with variable start date, each being one week apart, starting in cell T5 (say T5 = 4/12/06, U5 = 11/12/06, V5 = 18/12/06 etc). The last date is in cell AE5. I wish to loop along the range and find the date that today’s date (say 21/12/06) falls in (answer = 18/12/06). And enter that date in cell Q2.
View 4 Replies
View Related
Jan 20, 2007
I need a macro to find the date at the end of the week.
Ie today is saturday the 20th january - Macro would return the value 21/01/07.
Or IF the date today was the 24/01/07 - Macro would return the value 28/01/07.
View 9 Replies
View Related
Mar 9, 2007
I am comparing two series of data, a daily series and a weekly series, to make calculations. The "F" column is daily data and the "I" is weekly.
The formula I am using is:
=IF(AND( SUM(I58:I62)<F62,I63>F63),B64,0)
The data I need to use in the "F" column in place of "F62" is always on a Friday.
I had taken "F62" which is the preceding working day's data. In fact I need to take the preceding Fridays data in column "F" as I need to compare the week to week trends. Due to bank holidays I cannot count back form F62 to get the data. There is always end of week data recorded on Fridays even though it may be a bank holiday.
I have the dates in the "H" column. Can a date reference be used in the formula to find the Friday data in column "F"? Or is there another solution to this problem?
View 9 Replies
View Related
Apr 11, 2007
I have a formula =WORKDAY(TODAY(),-1) which will give me 10 Apr 07 in C1of sheet1 today. I am trying to find the cell in column A of sheet2 which has the date value equal to C1. However, my below macro keeps telling me object variable not set at the last line.
Dim s1, s2 As worksheet
Dim tdy As range
Dim today As Long
Set s1 = sheets("Sheet1")
Set s2 = sheets("Sheet2")
today = s1.range("C1")
Set tdy = s2.range("A1:A65536").find(today, lookin:=xlvalues)
tdy.Activate
View 9 Replies
View Related
May 28, 2008
I have a workbook with multiple sheets (one total and one for each pay period, 27 in all) to track time and attendance. From the main worksheet where my totals are, I want to be able to enter a date and then jump to the worksheet that date is found on.
For example, if I want to enter time for June 25, 2008, instead of searching for the right worksheet to find that date, I would like some way to type 6/25/2008 (US date) and enter, and that entry will take me to the worksheet that 6/25/2008 is found on so that I may then key my data. My dates are formatted in US style with the first date hard typed and the rest are =Date +1.
View 9 Replies
View Related