AutoFill Formula To Last Row Of Data
Jul 18, 2012
I have the macro to insert a formula and copy it in a range("A2:A14", but I want the end of the range in column A to be the last row with data in column B. How to add that in?
Sub vlookup()
Range("A2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[1],'[Old.xlsx]Total Student Count Data'!R2C2:R1000C2,1,FALSE)"
Range("A2").Select
Selection.autofill Destination:=Range("A2:A14"), Type:=xlFillDefault
Range("A2:A14").Select
End Sub
View 2 Replies
ADVERTISEMENT
Nov 14, 2008
Id like to apply a formula, any formula to an entire column if it contains data, and incorporate the original data in the calculation and then replace the original data with the result. I don't want to have to create new columns.
I'm using this to fix up database results; a common problem is dates in dot format e.g. 14.11.2008
All I have so far is an autofill formula that overwrites everything. Can someone help me with the rest? I'm using the SUBSTITUTE function to replace the dots '.' with slashes '/'
Sub Create_formula_result()
Dim Limit As Long
Dim r As range
Set r = range("A1")
r.FormulaR1C1 = _
"=IF(RC[0]"""",(SUBSTITUTE(RC[0],""."",""/"")+0) ,"""")"
Limit = ActiveSheet.UsedRange.Rows.Count
r.AutoFill Destination:=range(r, Cells(Limit, r.Column))
End Sub
View 9 Replies
View Related
Jan 20, 2008
Here is my test example I am trying to figure this out with.
Sub a()
Dim rg As Range
'set formulas to be filled
Range("A1").Select
ActiveCell.FormulaR1C1 = _
"=IF('sheet2'!RC="""","""",'sheet2'!RC)"
Selection.AutoFill Destination:=Range("A1:L1"), Type:=xlFillDefault
'now get autofill to populate until no more data on sheet 2
Set rg = [a2]
Set rg = Range(rg, Cells(Rows.Count, rg.Column).End(xlUp))
rg.Cells(2, 2).AutoFill Destination:=rg, Type:=xlFillDefault
End Sub
Without VBA, once I set the formulas for A1:L1, I can use the mouse to autofill all columns until Im around row 27,000.
Id like to be able to run a check for the end of data in sheet 2 so that if the sheet2 changes, it will all be included.
The resulting sheet1 cannot have any null values, so a perfect end of data check is necessary.
View 9 Replies
View Related
May 4, 2009
I have the following formula that I would like to be able to autofill.
=UniqueItem('Divide Outs'!$A$2:$A$999,1)
The 1 after the comma needs to count up...anyway to autofill a formula like this?
This is a function that i use to display unique listings.
View 3 Replies
View Related
Mar 29, 2007
I have data in colA. In colB I want to auto fill a formula that is in cell B1 all the way down and stop when the data in A stops.
Range("A1").AutoFill Destination:=Range("B1:B" & Range("B1").End(xlDown).Row)
It doesnt seem to like this though and I think ive got the cols all wrong in the formula.
View 4 Replies
View Related
Aug 1, 2012
The code below inserts a formula into E2, copies it across to column O and then down to the last row. It works fine but if more columns are added obviously it would need to be changed to go up to column P for example.
How can I change this so that the formula will be copied across to the last column automatically and therefore the code will not need to be changed?
Code:
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("E2").Select
[Code]....
View 2 Replies
View Related
Jan 4, 2008
I am trying to use autofill over a range of cells.
I am using a Do While loop to find an empty column in row 6 incremented by 5 based on LFound. The starting value of LColumn is 9 and is increased based on and IsEmpty condition.
Do While LFound = False
LColumn = 9
If IsEmpty(Cells(6, LColumn).Value) = True Then
LFound = True
Else
LColumn = LColumn + 5
End If
Loop
Next I want use this column index to put an equation in a cell
Cells(15, LColumn).Formula = "='" & SheetName & "'!C103"
Last I want to autofill the 8 cells below the refrenced cell.
Cells(15, LColumn).Select
Selection.AutoFill Destination:=Range(Cells(15, LColumn) & ":" & Cells(23, LColumn)),
Type:=xlFillValues
But I can't get the autofill to work. I think it is because of my attempt at going from Cells() to Range(),
View 3 Replies
View Related
Mar 8, 2013
I'm trying to autofill "vertically" in a spreadsheet using a formula which loads value from a different sheet.
Lets say I have cell (A1 for example) ='2013'!A39
Now I want to fill A2-A30 in a way that the formula updates to ='2013'!B39, ='2013'!C39, ='2013'!D39...and so on
I've tried using ='2013'!A$39, but this only copies the formula as it is. When I try to autofill cell A2-A30, the formula still is ='2013!A$39
Is this possible to do?
View 1 Replies
View Related
Jul 3, 2009
I have an xls with over 500 rows of data, every day I have to update the contents of some of the cells, Cell A contains the date and is auto filled already to the end of 2009, Cell B shows me the number of days since I began the sheet and is also auto filled already to the end of 2009, Cell C & Cell D I have to manually enter data
Cell E contains this formula =D527-D526
Cell F =C527/B526
Cell G = =IF(C527=0,0,C527-C526)
Cell H resorts to manual entry.
My question is "why do these columns with formulas, (E,F & G) not automatically carry the formula to the next row?" I'm sure that they once did. Is it a setting that I can't find?
This is excel 2007.
View 6 Replies
View Related
Oct 3, 2007
need to autofill collum C with a formula related do collum B. If I do this by hand I just type the formula in C 1, and click on the right-down corner of the cell selection, and the formula goes until the last line (last value on collum B). But I want to create a macro to this function, and the problem is that the files that I will apply the macro have different lengths. I want to modify the macro to be able to run from C1 until the end of the values on collum B. I don't want to freeze the last value.
Here is the macro
Sub Macro3()
ActiveCell.FormulaR1C1 = "=60000/RC[-1]"
Range("C1").Select
Selection.AutoFill Destination:=Range("C1:C4819")
Range("C1:C4819").Select
Range("E7").Select
End Sub
In other files C4819 will not be the last value, could be 5345 for example, but its impossible to do this, my macro should do: "autofill collum C with a formula until the last value on collum B"
View 9 Replies
View Related
Dec 9, 2013
I am trying to auto fill this formula down a column but it doesn't keep the C4,D4,E4...ETC to stay constant
I manually did these two correct ones
=SUM(C5*C4+D5*D4+E5*E4+F5*F4+G5*G4+H5*H4+I5*I4+J5*J4+K5*K4+L5*L4+M5*M4+N5*N4
+O5*O4+P5*P4+Q5*Q4+R5*R4+S5*S4+T5*T4+U5*U4+V5*V4+W5*W4+X5*X4+Y5*Y4+Z5*Z4+AA5*AA4)
=SUM(C6*C4+D6*D4+E6*E4+F6*F4+G6*G4+H6*H4+I6*I4+J6*J4+K6*K4+L6*L4+M6*M4+N6*N4
+O6*O4+P6*P4+Q6*Q4+R6*R4+S6*S4+T6*T4+U6*U4+V6*V4+W6*W4+X6*X4+Y6*Y4+Z6*Z4+AA6*AA4)
when I drag it down it incorrectly looks like this:
=SUM(C7*C6+D7*D6+E7*E6+F7*F6+G7*G6+H7*H6+I7*I6+J7*J6+K7*K6+L7*L6+M7*M6+N7*N6
+O7*O6+P7*P6+Q7*Q6+R7*R6+S7*S6+T7*T6+U7*U6+V7*V6+W7*W6+X7*X6+Y7*Y6+Z7*Z6+AA7*AA6)
I want C6,D6,E6 to be C4,D4,E4 ETC
View 3 Replies
View Related
May 3, 2007
I have two formulas which I'm using: =180*(120.5-1)/119.5 and =90*(60.5-1)/59.5
In the first example, I want to replicate the formula across row 1, but with the value '1' incrementing by 1 each time, upto 240.
In the second example I want the '1' value to also increase by 1 for each cell down column B, up to 120. when I try dragging the formula down or across, I am only able to replicate the formula exactly as in the initial cell (ie. the '1' doesn't change). I've tried using the $ symbol, but this doesn't work. I don't fancy doing this manually for a total of 360 cells!
View 5 Replies
View Related
Jun 7, 2007
I have two worksheets in the same workbook. In Sheet1, I've got a whole bunch of stuff that I need listed, like names, addresses, phone numbers, etc. What I want to do is pull the values of only the names, which are listed every 42 spots, and put them into a list on Sheet2. So, for example, in Sheet1, A1 is a name, A43 is a name, A85 is a name, etc. In Sheet2, I want to list only the names. And if there isn't a name yet, I want a blank cell. I've sorta figured out how to do it, but I get a problem with the values not incrementing correctly.
So, example code would be
=IF(ISBLANK(SHEET1!A1),"",A1)
=IF(ISBLANK(SHEET1!A43),"",A43)
etc.
The problem is when I drag the auto fill, the next values it gives are
=IF(ISBLANK(SHEET1!A3),"",A3)
=IF(ISBLANK(SHEET1!A44),"",A44)
Instead of the
=IF(ISBLANK(SHEET1!A85),"",A85)
=IF(ISBLANK(SHEET1!A127)"",A127)
....
that I want it to give.
is there anyway to get the values to go up like I want them to, or do I have to enter them all individually? That would really not be fun for me, so I hope that's not the case.
View 4 Replies
View Related
Dec 29, 2013
My main data tab is collecting gallons pumped for a particular piece of equipment. I have a drop down box to populate the piece of equipment and VLookup to identify the unit number associated with the equipment. I would like to create a separate tab for each piece of equipment that will track the number of gallons pumped during the calendar year. Here is the format for the main tab:
DateBeginning Meter ReadEnding Meter Read GallonsEquipment IDEquipment Description
1/2/2014565443565625 18212006 ford f250
1/10/2014565625565675 5022006 Chevy 2500
1/11/2014565675565750 754Ford Taurus
1/12/2014565750565830 8012006 ford f250
1/13/2014565830565900 7012006 ford f250
1/14/2014565900566000 10012006 ford f250
1/15/2014566000566125 12512006 ford f250
1/16/2014566125566215 9012006 ford f250
Here is the format for each piece of equipment:
2006 Ford F250
Date Gallons
1/2/14 182
1/12/14 80
1/12/14 80
1/12/14 80
1/13/14 70
1/14/14 100
1/15/14 125
1/16/14 90
The formula I used in Cell A4 is =INDEX(Gasoline!A4:A23,MATCH(1,Gasoline!F4:F19,FALSE),1)
Cells A4 and B4 have the correct values. My problem comes in A5,A6 and B5,B6. These should not have a result because they are different pieces of equipment. Throughout the year, each piece of equipment is going be used on the main tab. How do I keep the individual tabs from picking up the same entry multiple times.
View 2 Replies
View Related
Jul 30, 2009
Copy and paste the formula into a range or paste a formula into the first cell in the range and autofill down for remainder of cells?
P.S. when autofilling down, can I specify somehow for it to stop at the last row with data in adjacent cell?
View 9 Replies
View Related
Sep 2, 2013
I am using Windows 7, with Excel 2010.
I have one Worksheet Short Course - PB's Which contains all swimmer information and searches through all previous swims and reports back the swimmers current Personal best times (PB)
I am creating a work sheet to calculate percentage increases over a set date period. I have managed the calculations but can not get the autofill to function as I was hoping.
In my short course sheet 1 Row = a Swimmer and there details
In my new sheet, I have 3 rows for the same swimmer
Row 1= Swimmer and PB's before a set date
Row 2 = Swimmer and PB's After set date and upto Todays date
Row 3 = Percentage calculation of difference between the two rows to enable track performance increase
I have all of this working and in place and want to copy the formula's down now to cover all swimmers in the club.
When I copy the 3 lines down, Autofill adds 3 to the row reference for the first line and I just want it to add 1.
ROW3) =IF('Short Course - PB''S'!A3="","",'Short Course - PB''S'!A3)
ROW4) =A3
ROW5) = A3
[Code].....
View 4 Replies
View Related
Jan 21, 2010
I have one row which contains a different formula in each column. Is there any way I can have a macro autofill the data from another table?
I would need it to:
Apply a number of formulas to a row,
Find the last row of a table
Apply the autofil based on the row with the formulas.
View 4 Replies
View Related
Jan 5, 2012
I enter customer details onto an excel 2010 spreadsheet, ie customer name, date, description of order, amount of order etc. Sometimes, under certain criteria, the same or part of the same information needs to be added to another tab, ie tab2, on the same spreadsheet. I wanted to create an automated system to populate tab2, but cant figure out how.
I thought about creating another column in tab1, before all the customer information, which had a dropdown list option for yes/no when asked the question 'does it fit the criteria to add customer information to tab2'. This column would act as an alert, so that if i selected 'yes', then any customer information i enter in tab1 would then populate into tab2.
View 7 Replies
View Related
May 29, 2014
I'm trying to autofill data in a column from one sheet to another in the same workbook. My goal is to be able to paste data in one sheet and have it appear in another sheet.
View 2 Replies
View Related
Jan 11, 2009
1.
column b should autofill the last number in column i
in this case b12 = £1820.58
and then evertime column i has data in it should go to the next row in column b
2.
i would like column d to be blank until there is a stake in column c
3.
the same for column f, h and i
4.
column l should have the date auto entry after column c has data input
5.
column n should automatically work out how many days this has been running
6.
sheet 2 cell g5 should know how many records are in sheet 1
7.
sheet 2 cell g6 should return all known "y" in sheet 1 column g
and g7 should return all known "n" in sheet 1 column g
column i.........................
View 2 Replies
View Related
Feb 27, 2009
On Sheet1 I have a small list of names in column A and a number next to the name in column B. This number may vary.
What I want to do is on Sheet2 in column A repeat the name based on the number from sheet1 in column B.
Now the sheet is shared among all of us and macro are out. Is this something that is possible with a function?
View 9 Replies
View Related
Nov 2, 2006
I have used the following VBA quotes for my workbook to remove auotfills and data that I want to remove from my worksheet. The workbook has multiple worksheets and the worksheet that I want to use this VBA on is on worksheet 10 (ie. Sheet10). what's wrong with the VBA codes that I have below? Currently nothing happens whenever I try to click on the button that's linked to this code and there's no error message.
Sub ClearStuff()
Dim rng As Range
For Each rng In Sheets(10).Range("C18:BV" & Sheets(10).Range("B65533").End(xlUp).Row)
If rng.Value = Sheets(10).Range("D11").Value Then
rng.ClearContents
rng.Interior.ColorIndex = xlNone
End If
Next rng
End Sub
View 2 Replies
View Related
May 21, 2013
Here My first thread autofill horizontally from other sheet vertical data.
Vertical Data
Sheet1
A1
A2
A3
A4
& so on
AUTOFILL HORIZONTAL DATA
Sheet2
D3,D4,D5,D6..... fill by A1 A2 A3 A4.....
View 5 Replies
View Related
Jun 22, 2009
I have an excel file that contains two sheets. Sheet2 contains rows of different types of products with each of the columns containing details about the product.
On Sheet1, I have setup a data validation list in which a certain cell contains a drop down box that selects a product from the first column of all the rows on t from Sheet2. I used
View 3 Replies
View Related
May 13, 2006
I'll do what I can to explain this mess I want to clear up...I have a series of excel reports I have to download and work thru daily and I need to see if there is a code to autofill down thru a column, based on multiple statements throughout the column..here goes:
f1 msp
f2 msp
f3 blank **
f4 mct
f5 mct
f6 mct
f7 blank **
f8 cci
f9 blank **
Regardless of the actual f cell, I always will need to fill the Blank ** cell w/ the values from the previous cell....Hope this makes sense...& thanks in advance....
have_a_cup@cox.net
View 5 Replies
View Related
Jun 21, 2013
I would like to enter a long line of data (text & numbers) into a single cell and have the single cell data populate successive horizontal data fields with automatically. The single cell data would have properties that would correspond to specific properties in the successive fields. The single cell data would remain unchanged. The successive horizontal cells would be looking for a specific piece of the single cell data.
View 1 Replies
View Related
Jan 9, 2014
My Table has a data validation list in one row of a table. And different formulas in different rows.
The Table is expanded only into columns. Which means, there will be no new rows...only columns will be added.
If we enter text into the header cell in a new column, the whole new column gets formatted, but the list and formulas do not auto fill into new columns.
Of course an easy way is to copy and paste a column...but is there a way to auto fill lists and formulas into columns of the table? Similar to how the rows get autofilled?
View 4 Replies
View Related
Jan 23, 2014
In earlier versions if I used the double clicked the autofill handle it would only fill down to the next adjacent cell containing data. Now it fills down to the bottom of all the data regardless of whether there is a blank cell or not e.g
X X X Z
X X X Z
X X X Z
X X
X X X
Now this happens
X X X Z
X X X Z
X X X Z
X X ...Z
X X X Z
How can I stop this as I need to enter different data in the next section?
View 1 Replies
View Related
Feb 5, 2009
I am having trouble filling a formulae series to the left on one spreadsheet, the fomulae being references to another sheet.
For example, I have two sheets 'Mtce Options' and 'Base Case'. In 'Mtce Options' I have the following formulae
A B C
1='Base Case'!A15='Base Case'!D15='Base Case'!G15
I want to fill to the left, incrementing the column references by a factor of 2 each time, eg. next two should be ='Base Case'!J15 and ='Base Case'!M15.
However, if I autofill to the left by highlighting A1, B1 and C1 or just B1 and C1 all I get is an inappropriate reference such as ='Base Case'!D15 or ='Base Case'!F15, respectively, in D15.
View 2 Replies
View Related
Jul 28, 2014
I'm trying to autofill a series of rows (that are blank) with data from an above row. I want to autofill the row in its entirety, not just filling in blank cells.
For instance (assuming comma is a new column). Colors listed are just a data example. Space between commas indicates a blank cell:
142, RED, GREEN, , YELLOW, , BLACK, PURPLE
(blank row)
142, GREEN, RED, ,BLACK, , PINK, ,
(blank row)
(blank row)
(blank row)
154, YELLOW, BLACK, , GRAY, , PURPLE, RED
(blank row)
(blank row)
So rather than it just completing the task in one desired cell, it would complete the task over the entire spreadsheet. Data spread can be as far as row 500 and column BY, so you can see how a copy + paste or a drag would get monotonous.
Another small example data set:
1,1,1453,0,10,-35
(blank row)
(blank row)
0,0,1448,0, ,-35
(blank row)
1, ,1443,1,3,-36
1,2,1408,2,7, ,
(blank row)
(blank row)
(blank row)
1,2, ,2,7,-39
(blank row)
(blank row)
1,3,1344,1,10,31
And column A will always have data (unless the row is completely blank.
View 1 Replies
View Related