Macro To Compare Two Columns (Dates)?

Mar 10, 2014

My Process goes like this: We receive work in the excel sheet and in the column K(Period will be in YYYYMMDD)

First I want macros by which I can change YYYYMMDD TO MMDDYY.

then

It should compare column J and column K.

see the below example.

Period date (column K) Product end date (column L)

Column J column K

20131031 10/31/2013 = If column J & K dates are equal then "No action required"

20131031 7/31/2013 = If column J is higher then column K dates then "Action required"

20130930 11/2/2013 = If column J is lesser then column K dates then "No action required."

I need comments in column Q.

View 1 Replies


ADVERTISEMENT

Excel 2010 :: Compare 2 Columns With Dates?

Dec 11, 2013

I have 2 columns directly next to each other each containing dates.

Example 1:
F2 = 5/23/13
G2 = 5/23/14

Example 2:
F3 = 6/6/13
G3 = 4/11/14

I wanted to do a conditional formatting that would highlight the cell in
column G if the Month/Day doesn't match the Month/Day in column F

Is there a way to do this with Excel only looking at the Day/Month and ignoring the year??

View 3 Replies View Related

Unable To Compare Dates Using Macro

Dec 22, 2013

Currently I am working on a Userform based Macro that reads date and time from user and compares it with the date and time present in a cell in excel sheet(in mm/dd/yy hh:mm format). If the date and time value entered in both places matches then it will fill green colour in the cell.

I tried to convert the date present in excel sheet into a string using Cstr but it is not working. I have attached the code below for your reference.

Dim lr As Long, i As Long
lr = Sheet5.Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To lr
If Cells(i, "D") = "FIT" Then
If Left(Sheet5.Cells(i, 14), 1) = "M" Then

[code].....

View 3 Replies View Related

Macro To Compare Columns A & B And Dispaly Any Duplicates In Columns C & D

Feb 21, 2009

what I'm after is a macro to check the contents of Column 'A' against column 'B' and display any duplicates in Columns 'C' & 'D'.

N.B. The headings of Columns C & D are :-

C = Value Found in Column A

D = Value Found in Column B

Any duplicate entries logged in columns C & D should be listed in C2,C3,C4....C20 and D2,D3,D4......D20 etc (in effect creating two new lists)

View 5 Replies View Related

Macro To Compare The Columns Text

Apr 1, 2009

macro to compare 4 columns of text (first and last names) then add a checkmark in separate columns if they match and don't match?
For example I have this kind of data to compare and the results required:

Sheet 1
Last Name First Name
Smith Mike
Johnson Bruce
Hendrick Fred
Shaffer Kerry

Sheet 2
Last Name First Name Match No Match
Klee Pierre X
Verge Kerry X
Smith Mike X
Wright David X
Hendrick Fred X

I need the macro to mark an X in the Match column if the first and last names match only and if they do not match exactly a X in the No Match column.

View 3 Replies View Related

Macro To Compare Data In Two Columns

May 9, 2013

I have account numbers in Col A and in Col D .I would like a macro to highlight the color the items in Col D that are not in col D. Blanks can be ignored

View 3 Replies View Related

Compare Particular Range Of Columns By Macro

Jan 30, 2014

I need making a macro which compares a particular range of columns in one sheet to other sheet in same workbook.

It is like i have two worksheets named "Working Copy" and "Cleaned Data - (Working)". In this I have to compare Columns (A:AG) from Working Copy to columns (B:BH) of Cleaned Data - (Working). and if there is any difference between any cell then it should be highlighted with a colour in both the worksheets.

View 9 Replies View Related

Macro To Compare Two Columns And Identify Duplicates?

Jul 10, 2013

So here I have two columns Column 1 with repetitive values of some 10000 records Column 2 with unique values of 100 records I want to compare Column 1 and Column 2, identify the values in Column 1 that match with Column 2 and highlight them. Conditional formatting for duplicate values doesnt work because Column 1 has repetitive values.

View 6 Replies View Related

Macro To Convert Date Formats In Two Columns And Compare

Sep 15, 2014

I have two columns containing dates (Date1 and Date2). Date1 is like a long date and Date 2 is a short date. I need a macro to compare these two dates and delete rows where Date1 <> Date2. Please find attached the before and after file which also contains the date formats for these two dates.

View 8 Replies View Related

Macro Compare 2 Columns Different Worksheet And Copy Cell

Mar 28, 2014

I am trying to modify the macro listed below for the following example. It would work when I have only numerals in the cell but this new query, the cell has both letters and numbers.

I want to compare column "M" from worksheet one to column "B" in worksheet two. If the information matches, then copy the value adjacent from worksheet two column "A" to worksheet one column "L".

Here is the macro that worked for me using a search of only numerals.

figuring out why the data doesn't copy?

Macro:

Sub merge_accession_PS_rad_productivity()
Dim rng2 As Range, c2 As Range, cfind As Range
Dim x, y
With Worksheets("Imaging_Summary")
'N4=Accession on Imaging Summary worksheet

[Code]....

View 9 Replies View Related

Macro To Compare Values In User Specified Columns And Return To Different Workbook

Feb 21, 2014

I am trying to create a macro that will compare several un-formatted workbooks and copy just what I want to a workbook of my one.

I start by having 2 different workbooks opened ("Main" and "Change") side by side like this: 1.jpg

Then i run the macro in my "Main" workbook and it should appear an Userform like it showed in the image below: 2.jpg

This is so that i can manually fill the user form with the correct columns by looking at the excel file, for example:
Ref=E3;City=G3; Data=I3.

Pressing Ok, it fill the "Main" workbook with the matching information so it and closes the "Change" workbook.

At the moment my code is in this stage:

VB:
Private Sub CommandButton1_Click()
myfile = "C:Userssst1brgDesktopRelatorios" & TextBox1.Value
Application.Workbooks.Open Filename:=myfile
Windows.Arrange ArrangeStyle:=xlVertical

[Code] .....

But I am stuck because there isn't any error and nothing happens.

View 1 Replies View Related

Counting Formula (compare Values In 2 Separate Columns To See How Many Times The Same Value Appears In Both Columns)

Oct 13, 2008

I'm trying to compare values in 2 separate columns to see how many times the same value appears in both columns. Ideally I would be able to insert a range function to compare the values in the column "ID 1" against the values in column "ID 2" and return the count of times that a value appears in both columns. For example 2122, 1112 and 1718 appear in both columns and I would like the formula to return a count of 3.

ID 1ID 2
12342122
45671112
89101718
11122678
13144544
15162324
17189987
19201215
21221928
1976
2576
2345
4678

In my actual project I'm comparing 2 columns in the same worksheet. The column are column B with data in cells B2:B10266 against column C with data in cells C2:C18560.

View 4 Replies View Related

Compare Dates VBA

Jul 16, 2007

Using Excel 2003 on XP.

In Workbook1 I have a list of users with a leave start date in column N and a leave end date in column O.

In Workbook2 some of these of users appear with a payment start date in column C and a payment end date in column D.

I need to find out if the any or all of the payment period for these users in Workbook2 falls within the date ranges of their leave in Workbook1. If not, I need to ignore (or delete) the payment record in Workbook2 for that user.

Is this possible using VBA? Mind you, I'm stuck either way as I simply have no idea about how to approach this (possibly ... would first need to work out how to identify if the dates cross and then perform a lookup ...?)

View 11 Replies View Related

Compare The Dates....

Jan 29, 2010

I have two columns (G&H), one has expected date, and one has actual delivery date. The line amounts vary from 2500 to 8000, I need to calculate if column H is greater than column G for each line, if it is not then that line can be deleted.

View 4 Replies View Related

Compare Dates In VBA ..

Oct 30, 2009

I have the following date formatted strings in two Excel cells "17/12/2009" & "19/12/2013".

Now I try to run the following code on these cells:

If Range("B" & i).Value < Range("B" & j).Value Then
But it does not seem to work, as the dates are compared incorrectly.

Any clue how to bring these dates in a VBA readable format?

View 9 Replies View Related

Compare Two Dates And Convert To Age

Jul 17, 2009

I am trying to compare the difference between to dates (a person dob and the date of an activity they have carried out and then output the age of the person when this activity was done:

for example:

activity date: 08/01/2008
dob: 05/12/2007

View 14 Replies View Related

How To Compare Two Sets Of Dates Against One Another In VBA

Jun 11, 2014

I am trying to figure out how to compare two sets of dates against one another in vba. The data is spread over eight columns. I need to be able to find the smallest date in the first four columns and then compare it to the smallest date in the other four columns, then go to the next smallest and so on.

View 4 Replies View Related

Compare Dates In VBA Programming

Jun 8, 2006

I need to compare dates in excel (VBA programming). How can I do to Compare two dates. If I wanna know the difference between to dates (days, moths and years)

View 2 Replies View Related

Compare 2 Dates In VBA Code

Feb 15, 2008

I am getting a type mismatch error ehen comparing 2 dates. I tried entering all date formatting but it still throws the same error... here is my code. i have highlighted in bold where I get the error. the Error it throws is Run Time Error 13. Type Mismatch Error. I am using office excel 2003 SP3

Dim siebApp As SiebelWebApplication
Dim siebBusObj As SiebelBusObject
Dim revBC As SiebelBusComp
Dim isRecord As Boolean
Dim sRep As String
Dim sCompany As String
Dim sLocation As String
Dim sStep As String
Dim sProb As String
Dim sDate As String
Dim RetDate As Date
Dim CurDate As Date
Const DateCol = 9
CurDate = Now()
RetDate = Sheets("Users"). Cells(DateCol)
r = Sheets("Users").Cells(65536, 1).End(xlUp).Row 'Get next blank row
Sheets("Users").Cells(r, DateCol) = CurDate
'Create The Siebel WebApplication Object
Set siebWebApp = CreateObject("TWSiebel.SiebelWebApplication.1")...........................

View 5 Replies View Related

Compare Two Dates - Ensure Chronological

Dec 11, 2013

I have two enormous lists of dates. How do I automatically compare them to ensure the date on one comes after the date on the other one?

They're formatted as dates. Christmas Day 2000 (UK) did say 25/12/2000, and then when I reformatted it it automatically changed to 25 Dec 2000, and so on.

View 4 Replies View Related

Match Names And Compare Dates?

Mar 19, 2014

I've been trying for a few time to make a sub, on VBA, that writes, in a specific column, " " or 1 depending on the date that is inserted. The thing I can't quite do is:

1 - I have a sheet where the different projects of a company are stored (name, starting date, ending date and person responsible) and where new projects can be added from a UserForm

2 - I also have another sheet were costs from the projects are stored (one line with cost 1 from project 1, another with cost 2 also from project 1 and cost 3 from project 2, etc) and where I can also add a new cost with another UserForm (this cost as also a date that is added, to when it happened)

3 - What I need to do is, on the costs' sheet I need to create a sub that in the last column adds me 1 if the date of the cost added is not a date between the starting and ending date of the project that it corresponds.

View 1 Replies View Related

Compare & Flag Dates Formula

Jun 27, 2006

I am trying to set up a spreadsheet to track certification expiration dates and things of that nature at my volunteer fire department. At my career job, we use specialty software like Firehouse, but that is way too expensive so I must settle for Excel..or maybe Access.

Basically, I need a formula that will look at todays date and compare it to the date in a given cell and then somehow differentiate thise which are expiring at a given intercal.

For example, if someones EMT was expiring in 6 months it would turn yellow, then at 3 months turn blue, then red at 1 month then black if it expires.

It don't necessarily have to be just like that, just some way to differentiate depending on the how close to expiration it is.

View 3 Replies View Related

Compare 2 Dates For Month Differences

Oct 25, 2007

I need to compare dates from two workbooks. The dates are not entered in the same format. In order to compare them I store them in Date variables.

However, some dates entered do not have a standard date format (for example, day is missing) and I get an error when I try to store them in a Date variable.

The solution I thought out (most likely a bad one) was to temporarily re-dim the variable from Date to String when an error occured. The macro would then be able to store the incomplete date and do the comparison.

So, basically, the variable would be dim'ed once as a Date, then possibly dim'ed a second time as a String, and if this occurs, then it would be dim'ed back to a Date once the erroneous date would have been treated as a String.

My problem is that it doesn't appear to work if I use the dim statement because of "duplicate declaration in current scope". Is there a way to re-dim a variable as something else within the same macro?

View 6 Replies View Related

Compare Dates To Determine Which Is Greater

Apr 11, 2008

Battling through a problem, but would like to get some feedback on some failing code.
basicly created a bunch of macros to get 2 columns. One has last months dates, and the other has the new ones.

I want it to check if the date in columnH is greater then columnJ then update (i have vlookups to get this info with offsets). You see if there is no result on columnH it means it does not add a date.

heres the code that i have. The error is that i am using an invalid statement in the case ( i suspect the >=)

View 9 Replies View Related

Compare Last Names And Dates Of Birth From Two Spreadsheets

Feb 5, 2009

I have several old spreadsheets that contain patient information. Except for names, dates of birth, and dates of surgery there is nothing consistent about them. Not only that, the old spreadsheets were in various stages of compiliation and recompilation when they were abandoned. So now there are multiple duplications of old names added to lists of new names spread across multiple spreadsheets. I have to identify names that are not already in my database and add them.

I have a formula that I found on the internet that I can use to check if a patient’s last name in an old spreadsheet is one that already appears in my main database. In my attached example the formula looks like this:

View 3 Replies View Related

Compare Dates In Rows - Delete Then Shift Up

Mar 14, 2012

I am fitting 2 sets of data to match eachother. I want to have as much data as possible but only for the same dates of each dataset.

I have 4 coloumns.
Dataset 1: A is date B is data
Dataset 2: C is date D is data

I want to compare A vs B one row at a time. If they are not similar it should delete and shift up the values in A+B or C+D according to the lowest value (date) of A vs B.

Remember that if the macro just deleted and shifted up it should compare the same (undeleted) value against the new value that just shifted up in the other coloumn.

View 2 Replies View Related

Compare Dates Against One Date & Delete Rows

Nov 24, 2007

I have a column of dates (B2:B1500) that I want to compare to a single date (A1).

If the dates in Column B are older than the date in A1 I want to delete the entire row.

View 3 Replies View Related

Tracking Multiple Dates - 5 Columns - 5 Different Dates

Feb 14, 2014

I have 5 columns with different dates to track when certain items expire per employee. Conditional Formatting is working like a champ but the data is growing.

I'd like a way to 'quick glance' at all my people that are expired, coming up on expired (this month and next).

I was thinking if there was a script to run through all 5 columns, if the date was less than today, throw the 1st,2nd and 5-9 column (in that row) into a new table. That way i can keep my big sheet but have another sheet or table that i can see QUICKLY who all needs to get their stuff up to date.

View 1 Replies View Related

Excel 2003 :: Compare Two Dates With Dynamic Operator

Apr 18, 2013

I'm using Excel 2003.

I have a Userform where you can enter a date and select a comparison operator from a combo box. Any one of these (= < <= > >= <>)

In VBA I then load a range into a dictionary object and then loop thru it to compare the dates in the dictionary to the date selected in the userform but I can't get the dates to compare correctly. I think it has something to do with the Evaluate function comparing the dates as strings but I'm not really sure.

VB:
For Each strKey In dictValid.Keys()
If Not Evaluate(CDate(dictValid(strKey)) & cboDteOperator.Value & CDate(txtDteSel.Value)) Then

View 3 Replies View Related

Compare 2 Dates Using Networkdays, Assuming Both Column A & B Are Filled

Apr 20, 2006

I have a spreadsheet that captures task start and end dates similar to project. It currently calculates Networkdays correctly, so if you have:

1. 1/1/06 - 1/31/06 (22 Days)
2. 1/1/06 - 12/1/05 (- 22 Days - showing dates have been entered incorrectly.)
3. 1/1/06 - No End Date (-27655)

=IF(ISERROR(NETWORKDAYS(E23,F23)),"NA",NETWORKDAYS(E23,F23))

My concern is with #3, is there a way to instruct the formula that if columna and columb are not filled in,the result should be blank. Previously I had it where it indicated NA - but the problem with this is - while it appears fine in Excel, when I pull it into Access to report on I get the -27655. This is throwing my reporting off.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved