How to apply a formula to an entire column?

aspen_gal

New Member
Joined
Jun 30, 2009
Messages
4
Hello, below is a sample of my excel sheet. The number of rows keep changing daily and the Month and year column has to be populated automatically as and when there is a new row inserted. I tried the formula =MONTH(A:A) and I paste it on the entire column. it works for rows with data but I also get 104,000 odd blank rows added to my excel because I pasted the formula on the entire column. I do not want to add rows with blank data. I tried IF (Date is blank then insert "" in Month else put the month(Column A). All it does is inserts several 1000s of rows with MONTH ="".

Date Month year
10/10/2009


Thanks much!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Just trying to get a handle on what your're doing.. is your sheet something like the following ? You have a cell that contains the entire date and you need to process and split it up into 3 cells ?/

Excel Workbook
ABCD
1Whole DateDAYMONTHYEAR
24/14/20091442009
Sheet2
 
Upvote 0
yes sir! This is exactly what I want to accomplish, but my sheet will be loaded with data on a daily basis and I dont want to do the formula for every row added. I just want to create a template with the formula so that as the sheet grows, the formula is automatically calculated.
Thanks a bunch
 
Upvote 0
How about just adding this macro (adjust the columns as required)

Code:
Private Sub worksheet_change(ByVal Target As Range)
    Application.EnableEvents = False
    For x = 2 To Cells(Rows.Count, "A").End(xlUp).Row
        d = Cells(x, 1)         'cell with whole date   (rownum, "A")
        Cells(x, 2) = Day(d)    'clell to place the day  (rownum,"B")
        Cells(x, 3) = Month(d)  'etc
        Cells(x, 4) = Year(d)
    Next x
    Application.EnableEvents = True
End Sub
 
Upvote 0
Thank you and I just have to schedule this to run automatically..

My next question is besides a macro, isnt there any other way like an Auto fill or other Excel functions (no vba)?
 
Upvote 0
Not sure on the NO VBA option, but how do you populate your worksheet ? are you importing the data from a csv or something ? If so, this should run when you do so
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,007
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top