I have an excel file with a date column. I want to be able to sort the work sheet by that column and then run though the column and list all the gaps in the dates between consecutive records. For instance if cell C1 = 11/12/03 and C2 = 11/17/03 then the result would be 11/13/03 – 11/16/03. If C3=11/17/18 or 11/18/03 then the result would be No Gap. Not sure that this is possible?
Thanks.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Date Gap analysis (Excel 2000)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Date Gap analysis (Excel 2000)
- This topic has 32 replies, 6 voices, and was last updated 21 years, 6 months ago.
AuthorTopicWSwannaknow
AskWoody LoungerNovember 4, 2003 at 9:36 pm #396082Viewing 3 reply threadsAuthorReplies-
WSAlexya1
AskWoody LoungerNovember 4, 2003 at 10:08 pm #739546 -
WSAlexya1
AskWoody LoungerNovember 4, 2003 at 10:08 pm #739547 -
WSHansV
AskWoody Lounger -
WSAlexya1
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSAlexya1
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSwannaknow
AskWoody LoungerNovember 5, 2003 at 4:52 pm #739954Thanks to both of you for sharing the knowledge.
Is there is way to turn this into a macro/script that would automatically run for a selected column?
For example, if the dates are in column C, it would automatically populate column D with this formula for every record in C that had an entry?Thanks!
-
WSsdckapr
AskWoody LoungerNovember 6, 2003 at 11:49 am #739973(Edited by sdckapr on 06-Nov-03 07:49. Corrected “brain-fart”. Thanks, Tony.)
Don’t understand the need for a macro.
Why not (after you sort the data) put the formula in the top cell. Then select the cell and move the mouse to the bottom right corner of the cell (the cursor will change from a fat plus to a narrow plus. When it is the narrow plus dbl-click and the formula will be copied down the rows to the bottom of the data set.Steve
-
WSwannaknow
AskWoody Lounger -
WSsdckapr
AskWoody LoungerNovember 5, 2003 at 6:04 pm #739991Does the macro need to check for blanks within the data set or should you just fill in the formula from D2 to the last filled cell in C?
Do you want to keep the formulas in it or do you want the macro to just put the result of the formula?What all do you want to automate?
Should the macro work with just one sheet, all sheets in the activeworkbook, selected sheets in the activeworkbook, sheets with particular names in all open workbooks?You could do alot of it yourself, using the macro recorder and then generalize it.
Steve
-
WSwannaknow
AskWoody LoungerNovember 5, 2003 at 6:23 pm #740001Thanks Steve, I did attempt to use the macro recorder but was not sure how to generalize the column location, or the auto-fill to match the amount of records in the work sheet as that will vary…..
First i would like the macro to sort the entire sheet by the date column, C. (If it is not always C, can this be a parameter, or will i need to set this in the macro?) For a given date column, C, fill in the value in column D for every record in column C.
Macreo should only do the active sheet.Thanks.
-
H. Legare Coleman
AskWoody PlusNovember 6, 2003 at 1:57 am #740341The macro below will insert a column to the right of the column containing the active cell, and will then put Hans’ formula into rows 2 through the last row containing data in the column containing the active cell.
Option Explicit Public Sub AddFormula() Dim I As Long, lLastRow As Long, lCol As Long Dim oCell As Range lCol = Selection.Column Set oCell = ActiveSheet.Cells(1, lCol) lLastRow = ActiveSheet.Cells(65536, lCol).End(xlUp).Row - 1 oCell.Offset(0, 1).EntireColumn.Insert For I = 1 To lLastRow oCell.Offset(I, 1).FormulaR1C1 = _ "=IF(RC[-1]-R[-1]C[-1]=1,""No Gap"",TEXT(R[-1]C[-1],""mm/dd/yy"")&"" - ""&TEXT(RC[-1],""mm/dd/yy""))" Next I oCell.Offset(0, 1).EntireColumn.AutoFit End Sub
-
WSwannaknow
AskWoody Lounger -
WSwannaknow
AskWoody Lounger -
H. Legare Coleman
AskWoody PlusNovember 6, 2003 at 1:57 am #740342The macro below will insert a column to the right of the column containing the active cell, and will then put Hans’ formula into rows 2 through the last row containing data in the column containing the active cell.
Option Explicit Public Sub AddFormula() Dim I As Long, lLastRow As Long, lCol As Long Dim oCell As Range lCol = Selection.Column Set oCell = ActiveSheet.Cells(1, lCol) lLastRow = ActiveSheet.Cells(65536, lCol).End(xlUp).Row - 1 oCell.Offset(0, 1).EntireColumn.Insert For I = 1 To lLastRow oCell.Offset(I, 1).FormulaR1C1 = _ "=IF(RC[-1]-R[-1]C[-1]=1,""No Gap"",TEXT(R[-1]C[-1],""mm/dd/yy"")&"" - ""&TEXT(RC[-1],""mm/dd/yy""))" Next I oCell.Offset(0, 1).EntireColumn.AutoFit End Sub
-
WSwannaknow
AskWoody LoungerNovember 5, 2003 at 6:23 pm #740002Thanks Steve, I did attempt to use the macro recorder but was not sure how to generalize the column location, or the auto-fill to match the amount of records in the work sheet as that will vary…..
First i would like the macro to sort the entire sheet by the date column, C. (If it is not always C, can this be a parameter, or will i need to set this in the macro?) For a given date column, C, fill in the value in column D for every record in column C.
Macreo should only do the active sheet.Thanks.
-
WSsdckapr
AskWoody LoungerNovember 5, 2003 at 6:04 pm #739992Does the macro need to check for blanks within the data set or should you just fill in the formula from D2 to the last filled cell in C?
Do you want to keep the formulas in it or do you want the macro to just put the result of the formula?What all do you want to automate?
Should the macro work with just one sheet, all sheets in the activeworkbook, selected sheets in the activeworkbook, sheets with particular names in all open workbooks?You could do alot of it yourself, using the macro recorder and then generalize it.
Steve
-
WSwannaknow
AskWoody Lounger -
WSBilasTasol
AskWoody LoungerNovember 6, 2003 at 11:46 am #740455 -
WSsdckapr
AskWoody Lounger -
WSsdckapr
AskWoody Lounger -
WSBilasTasol
AskWoody Lounger -
WSBilasTasol
AskWoody Lounger -
WSBilasTasol
AskWoody LoungerNovember 6, 2003 at 11:46 am #740456 -
WSsdckapr
AskWoody LoungerNovember 6, 2003 at 11:49 am #739974(Edited by sdckapr on 06-Nov-03 07:49. Corrected “brain-fart”. Thanks, Tony.)
Don’t understand the need for a macro.
Why not (after you sort the data) put the formula in the top cell. Then select the cell and move the mouse to the bottom right corner of the cell (the cursor will change from a fat plus to a narrow plus. When it is the narrow plus dbl-click and the formula will be copied down the rows to the bottom of the data set.Steve
-
WSwannaknow
AskWoody LoungerNovember 5, 2003 at 4:52 pm #739955Thanks to both of you for sharing the knowledge.
Is there is way to turn this into a macro/script that would automatically run for a selected column?
For example, if the dates are in column C, it would automatically populate column D with this formula for every record in C that had an entry?Thanks!
-
WSHansV
AskWoody Lounger
-
-
-
WSAlexya1
AskWoody Lounger
-
-
-
WSHansV
AskWoody Lounger
WSAlexya1
AskWoody LoungerWSHansV
AskWoody LoungerViewing 3 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Teams lost all my Skype contacts (Awaiting moderation)
by
Lucy
4 hours, 13 minutes ago -
0Patch, where to begin
by
cassel23
8 hours, 9 minutes ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
11 hours, 9 minutes ago -
89 million Steam account details just got leaked,
by
Alex5723
19 hours, 33 minutes ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
19 hours, 42 minutes ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
10 hours, 40 minutes ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
13 hours, 4 minutes ago -
Installer program can’t read my registry
by
Peobody
4 hours, 2 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
8 hours, 27 minutes ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
15 hours, 48 minutes ago -
False error message from eMClient
by
WSSebastian42
1 day, 6 hours ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
1 day, 15 hours ago -
Office 2021 Perpetual for Mac
by
rebop2020
1 day, 17 hours ago -
AutoSave is for Microsoft, not for you
by
Will Fastie
13 hours, 43 minutes ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
1 day, 20 hours ago -
Seven things we learned from WhatsApp vs. NSO Group spyware lawsuit
by
Alex5723
21 hours, 40 minutes ago -
Outdated Laptop
by
jdamkeene
2 days, 2 hours ago -
Updating Keepass2Android
by
CBFPD-Chief115
2 days, 7 hours ago -
Another big Microsoft layoff
by
Charlie
2 days, 7 hours ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
4 hours, 32 minutes ago -
May 2025 updates are out
by
Susan Bradley
6 hours, 24 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
2 days, 13 hours ago -
Windows 11 Insider Preview build 26120.3964 (24H2) released to BETA
by
joep517
2 days, 13 hours ago -
Drivers suggested via Windows Update
by
Tex265
2 days, 13 hours ago -
Thunderbird release notes for 128 esr have disappeared
by
EricB
9 hours, 8 minutes ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
2 days, 20 hours ago -
Apple releases 18.5
by
Susan Bradley
2 days, 14 hours ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
2 days, 21 hours ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
2 days, 22 hours ago -
Windows 7 ISO /Windows 10 ISO
by
ECWS
1 day, 6 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.