Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2008

Tip: Looking for answers? Try searching our database.

How to fill missing cells in the collumn of dates?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Artem - 09 Apr 2008 11:47 GMT
Hi,

I have large set of data. I have two columns for every variable: first
consists of dates (from 01.01.2000 to 01.01.2008) and the second column
consists of values for every date. The problem is that some dates are missed
(for example I have 01.01.2000 and next row is 05.01.2000). Is it possble to
insert row for every missed date and fill the date in the first column? I can
do it manually but I have 7 variables with different set of dates so it will
take ages to do it manually.

Thanks.
Bernard Liengme - 09 Apr 2008 15:03 GMT
In  column A I have: A,B,blank,blank,C,blank, blank,blank,D
In G1 type =A1
In G2 type =IF(ISBLANK(A2),G1,A2)
Copy this down as far as needed
Now I have in G: A,B,B,C,C,C,C,D
I can Copy this range; move to A1 and use Edit | Paste Special , with Values
box checked.
Now A has what I want and I can delete G

I expect someone will tell how to use GoTo Special.
Try all solutions on a copy of your working file and see which you like
best.
best wishes
Signature

Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

> Hi,
>
[quoted text clipped - 11 lines]
>
> Thanks.
Max - 09 Apr 2008 15:38 GMT
Another play to tinker with ..

Assume data in cols A and B, real dates in A1 down, values in B1 down

In D1:
=IF(A$1+ROWS($1:1)-1>MAX(A:A),"",A$1+ROWS($1:1)-1)

In E1:
=IF(ISNA(MATCH(D1,A:A,0)),"",VLOOKUP(D1,A:B,2,0))
Select D1:E1, copy down until blanks appear, signalling exhaustion of
extract. Cols D & E should return what you're after.
Signature

Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---

> I have large set of data. I have two columns for every variable: first
> consists of dates (from 01.01.2000 to 01.01.2008) and the second column
[quoted text clipped - 5 lines]
>
> Thanks.
Dave - 09 Apr 2008 16:04 GMT
Hi Aterm,
Here is a VBA solution.
It dumps all missing dates into a spare column that you select by changing
the value of MDC.
You then copy and paste those dates to the bottom of your dates column, and
do a SORT. Remember to include both your date column and your data column in
the sort!
You also need to change the values of DC and DR to match your dates
location. See the notes in the code, which will be green once pasted into a
module.
You should do this on a copy of your data first.

Sub ListDates()
Dim DC As Integer
Dim DR As Integer
Dim NM As Integer
Dim MDC As Integer
Dim MDR As Integer
DC = 1 'Change this value to your Dates Column Number (A=1, B=2 etc)
DR = 1 'Change this value to your Dates 1st row number
MDC = 2 'Change this value to any spare column number (A=1, B=2 etc)
MDR = 1
Do Until Cells(DR + 1, DC) = ""
   NM = Cells(DR + 1, DC) - Cells(DR, DC) - 1
   Do Until NM = 0
       Cells(MDR, MDC) = Cells(DR, DC) + NM
       NM = NM - 1
       MDR = MDR + 1
   Loop
DR = DR + 1
Loop
End Sub

Regards - Dave.
Max - 10 Apr 2008 00:33 GMT
Just to clarify ...

If you have this data in A1:B3 (for one variable)
29-Dec-00    1
2-Jan-01    8
4-Jan-01    7

then you'd get this desired result in D1:E7
29-Dec-00    1
30-Dec-00   
31-Dec-00   
1-Jan-01   
2-Jan-01    8
3-Jan-01   
4-Jan-01    7

If the above doesn't work, then that probably means your dates in col A
aren't real dates. You can easily convert it to real dates all at one go via
selecting col A only, then click Data > Text to Columns. Click Next>Next to
go to Step 3, check "Date", then select, say*: DMY, click Finish    
*select the correct date format

P/s: You should feedback to all who have responded to you
Signature

Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---

Artem - 11 Apr 2008 14:13 GMT
Sorry guys, couldn't leave some feedback before because I've just read all
advices! I tried to use all 3 methods that was supplied. VBA code doesn't
work for me, may be something was wrong. I have very little expirience in VBA
so I just left this method, but thanks anyway! From 2 methods with Excel
functions I like the best method that was provided by Max. It's quite simple
for me and works fine (I've just replaced all "," in formulas with ";").

Thanks everyone for help, you saved me lots of time!!!

> Just to clarify ...
>
[quoted text clipped - 19 lines]
>
> P/s: You should feedback to all who have responded to you
Max - 11 Apr 2008 14:30 GMT
Welcome, and thanks for feeding back.

Do take a moment to click the "Yes" button below
from where you're reading this
Signature

Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---

> Sorry guys, couldn't leave some feedback before because I've just read all
> advices! I tried to use all 3 methods that was supplied. VBA code doesn't
[quoted text clipped - 4 lines]
>
> Thanks everyone for help, you saved me lots of time!!!

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.