Formula With Offset From Active Cell And Sum Until Blank Cell
Dec 24, 2013
I have a formula in cel B1 : =SUM(A2:A100) / A1
I would like to use this formula many times in the sheet, so I would need a reference to the cell the formula is in, and have the SUM range until the next empty cell one column to the left.
So I would need something like (literally):
=SUM(Offset activecell (1,-1) : Offset activecell (1, (look for next empty cell -1)) / Offset activecell (0,-1)
View 3 Replies
ADVERTISEMENT
Nov 26, 2008
ThisWorkbook.Sheets(2).Cells(nrow + 1 + j, 2 + high_count).Formula = "=VAR(" & ActiveCell.Offset(0, n_high_count -1) & "," & ActiveCell.Offset(0, -1) & ")"
*n_high_count is the negative of high_count
I want "ThisWorkbook.Sheets(2).Cells(nrow + 1 + j, 2 + high_count)" to have the formula "=VAR(XX:XX)" where the range is the current row second column to the current row current column -1.
View 9 Replies
View Related
Jul 28, 2006
I need to make the active cell go to the beginning of the row (Column A). I tried setting up a variable to be the row.value, but that didn't work (the way I wrote it, which doesn't surprise me).
View 6 Replies
View Related
Jul 30, 2012
I have 2 columns of data
column A = weeks (A2:A50) i.e. P1W1, P1W2, P1W3....P12W4 etc
column B = headcount (B2:B50) i.e. 5, 7, 5...10 etc
Essentially my criteria is "looking for last week and give me headcount" i.e. my lookup criteria is P7W5 ....however if P7W5 has no data, i want the lookup to go up or offset to the row above (it may be one to 4 rows above)....
View 3 Replies
View Related
Dec 8, 2006
I am aware of the ColorIndex, but more specifically I need to change the fill color of a cell that is 9 columns to the right of the active cell. I can't find out how to make this work. to clarify:
ActiveCell + 9 columns.Interior.ColorIndex = Yellow
There has got to be an easy way to do this.
View 3 Replies
View Related
Nov 11, 2009
Get value from another cell using Offset and active cell. I can do this in VBA but I cant seem to do it on a worksheet.
View 4 Replies
View Related
Jul 11, 2007
I have checked archives, some similiar but not quite what I want.
In code below I want the output instead of going offset one column to right in same row to go one column to right into the next blank cell.
View 9 Replies
View Related
Oct 2, 2013
I am trying to achieve the below objective but getting error message
Objective: select last non blank row and offset to next cell type a message in it
error message: Runtime error 1004 : method 'Range' of Object '_Global' Failed
CODE:
Sub lastRowAll()
myvar = ActiveSheet.UsedRange.SpecialCells(11).Column
myrow = ActiveSheet.UsedRange.SpecialCells(11).Row
Range(myvar, myrow).Offset(0, 1).Value = "Experiments with VBA"
Range(myvar, myrow).Offset(0, 1).Activate
End Sub
View 6 Replies
View Related
Nov 5, 2009
After sorting data I have a column starting in G3 that contains blank cells at the top and then data.
1. I need to find the first 4 active cells that contain data in column G, and then copy the corresponding data contained in columns A,B and C.
2. I then need to paste the data from these 3 columns ( A,B,C) to a Cell starting at R16
View 9 Replies
View Related
May 23, 2012
What can I add to the macro I already have in place (below) to accomplish what I'm looking for (2 parts)? ...
1) I need to copy everything (formulas) that is in C7:F7 and paste it down to all "active" rows - I'm defining an active row by any row where column A is not blank.
2) I need to copy everything (formulas) that is in Q7:AF7 and paste it down to all "active" rows - I'm defining an active row by any row where column P is not blank. (You'll notice by the screenshot that there will be blank cells in column P mixed in with non-blank cells.)
Code:
Sub AdminTool()
'
' CreateAdminTool Macro
'
'
ActiveWindow.Zoom = 90
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
[Code] ...........
View 7 Replies
View Related
Feb 13, 2014
I'm trying to do a column of individual discount calculations using a discount percentage found in a cell two to the right of a cell containing the text "Total SP:" that is always upwards and to the left of the cell where the formula goes (but could be two rows or could be 20). There are multiple "Total SP:" cells in the sheet - I always want the first one upwards. I have created the following but I get #NAME? where I hope to see the discounted value.
VB:
Dim Discount1 As Double
Discount = Cells.Find(What:="Total SP:", After:=ActiveCell, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=True).Offset(0, 2)
Range("R9:R" & LastRow).Formula = "=IF(J9>0,$E9*(1-Discount1),0)"
I've just thought, the Cells.Find needs to be redone for each cell where the formula is inserted to ensure it always catches the correct discount and this isn't going to do that - it's going to find it once and always use that single value.
I think this needs a Loop or something and to move the ActiveCell down one after the formula to get it to redo the Cells.Find.
View 1 Replies
View Related
Dec 1, 2009
I have a range of unlocked cells (B5:S10) that users enter data in. This sum of this data is then charted. The formula (sum) in a cell equals zero even when there is no data entered by the user. This zero is then charted.
I need to be able to plot the zeros if the user enters zeros but not plot the zero if the cells are blank.
What I was attempting to do is to use the worksheet change event to add the formulas to a cell so that the chart does not plot the value until something was added.
In my change event I need to know that a cell in the range (B5:S10) was changed and that if it was D7 (for example) that I need a formula enterd in D11 [=SUM(D5:D10)]. If it was I5 then the formula would have to go in I11 [=SUM(I5:I10)].
View 8 Replies
View Related
Dec 10, 2012
whenever the active cell is within a given range, highlight the cell on the same row in column S (by changing its interior colour). This should occur each time the active cell is changed, whether by cursor keys or mouse. The effect would be similar to the row and column highlights at left and top of the worksheet.
This action should be restricted to one sheet in the workbook.
It's for Excel 2003.
View 3 Replies
View Related
Jul 28, 2014
My workbook is for financial planning but I'm attempting to streamline an input page (name, birthdate, etc) that will be referenced throughout the entire workbook to trigger automatic calculations (present value, education calculations, etc).
The cell in the input page is a birthdate - which when populated will trigger a cell on a different worksheet to calculate the respective age using this formula:
Code:
=IF(MONTH(TODAY())>MONTH('Input Page'!B30),YEAR(TODAY())-YEAR('Input Page'!B30), IF(AND(MONTH(TODAY())=MONTH('Input Page'!B30),DAY(TODAY())>=DAY('Input Page'!B30)),
YEAR(TODAY())-YEAR('Input Page'!B30),(YEAR(TODAY())-YEAR('Input Page'!B30))-1))
The problem is if there is nothing written in the birthdate cell then the age cell will automatically calculate 114 (reference photo below). Ideally I'd like that cell to be blank if nothing is in the birthdate cell on the input worksheet. I'm assuming since I'm using an IF formula to calculate the age already then I'll need to use a macro to to an "ignore".
[URL] ...........
View 2 Replies
View Related
Aug 2, 2014
I can't modify my formula to leave blank cells blank when dragging it down, Also, I've got two formulas that i need to combine. Please view the comments I've put in cells E4, F2,F3,H2 and I2 to understand clearly what am seeking. See the attached worksheet.
View 8 Replies
View Related
Jun 8, 2014
I have got stuck on one piece of my code and having trouble fixing... Overall I am trying to find variable station name in cell L2 of Sheet 2 in Sheet 1 and then select and copy the data from the data in "cell L2 of Sheet 2" to the last entry of that row. I have attached an example test spreadsheet of the data and a macro is within Sheet 1 called test1. Please note that cell L2 in Sheet 2 will always be different station name and the station list in Sheet 1 will change with differing station name.
The code I am using is:
[Code] .....
The code that is not working and bringing up an error is:
[Code] .....
Attached File : Copy of Testexample.xlsm
View 2 Replies
View Related
Aug 12, 2014
I have one column that contains an If statement formula and would like the next column to then work off of the first column (i.e. if that 1st column returns a value then then adjacent column uses that result).
What is happening now is that it is returning #value (because I guess technically the cell isn't blank?)
View 5 Replies
View Related
Feb 8, 2010
I have attached a sample of the spreadsheet. The cell/cells in question are f32:f36 on the first tab.
Question #1 how this formula works or what it does.
Question #2 Is when I enter the required information in cells a32:e32 it enters an N/A in cell f32. When I than click on cell F32 and than click on the formula bar and hit enter the information populates.
View 2 Replies
View Related
Jan 7, 2014
Ok, basically C3 is a dollar amount. The default total for C3 is $0.00. If C3 is $0.00 then this formula cell will display a blank cell. If there is any other amount in C3 then the formula C3-C2 will run.
I tried this but it's not working:
=IF(C3="0","",C3-C2)
View 2 Replies
View Related
Jan 14, 2013
I need a macro to find the last cell in the column, then copy the formula to the next blank cell. Then, it goes back to the last cell (above) and paste's values. Then, go to the next column and repeat the process. I can do this but have to call each cell separatly...however, I would like to do it in a loop to simplify things. It would be great to even be able to just set the start and ending columns. Here is my current code:
Dim rng As Range, aCell As Range
Set rng = Range("C8, D8, E8, F8, G8, H8, J8, K8, L8, M8, N8, O8, P8, Q8, R8, S8, T8, U8")
For Each aCell In rng
Selection.End(xlDown).Select
Application.CutCopyMode = False
[Code] .......
It does not go to the next column, instead it stays in the same column and repeats the process.
View 8 Replies
View Related
Feb 25, 2014
I am trying to use the code below to enter formulas into two different cells.
The first code "ActiveCell.FormulaR1C1 = "code" is running ok.
But the second one "ActiveCell.FormulaR1C1 = "=IF(IFERROR(IF(AND(1*LEFT(D2,2)>=61,1*LEFT(D2,2)<=65),VLOOKUP(AA2,'abc'!A:C,3,FALSE),""),"")="",D2,D2&AA2)" is getting error.
Sub Combine()
Dim wbk1 As Workbook, wbk2 As Workbook
fileStr = Application.GetOpenFilename()
[Code].....
View 9 Replies
View Related
Sep 19, 2006
I have a "Match" formula in a cell that gives me the Row number of the Cell matching the criteria (lets say row 502) and the Column is always B. With VBA I want to make my ActiveCell the cell (B502) referred by the "MATCH" Formula.
View 5 Replies
View Related
Feb 26, 2008
I am using a IF(ISNA(Vlookup##,##,##)),"",(Vlookup##,##,##)) function, in order to remove N/A errors.
Is there anyway to convert the "" values to back to an empty cell without anything in it (i.e not text "", but empty as it was originally). I find that the file sizes are very large, when using this function, as data (although blank) is stored in each cell (i know this, because if I use cntr+arrow, it sees it as data, and not an empty area). I don't want to manually go through each cell and delete them as there is quite a bit of data (10000 rows , 2 columns, 30 tabs)
View 5 Replies
View Related
Feb 26, 2008
I am using a IF(ISNA(Vlookup##,##,##)),"",(Vlookup##,##,##)) function, in order to remove N/A errors. Is there anyway to convert the "" values to back to an empty cell without anything in it (i.e not text "", but empty as it was originally). I find that the file sizes are very large, when using this function, as data (although blank) is stored in each cell (i know this, because if I use cntr+arrow, it sees it as data, and not an empty area). I don't want to manually go through each cell and delete them as there is quite a bit of data (10000 rows , 2 columns, 30 tabs)
View 2 Replies
View Related
Mar 11, 2013
I am desperately find a way to fill down formula from active cell, example given below,
AA
BB
CC
Total
QTY1
QTY2
City 1
5
2
3
10
12
15
[Code] .......
I need to fill down col Qty 1 & Qty 2. Number of Rows and Columns vary in my Work Sheet.
My code below, Ctrl+Enter not works.
HTML Code:
Cells.Find(What:="QTY1").Activate
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=RC[-1]+RC[-3]"
'Fill Down Active Column
Cells.Find(What:="QTY2").ActivateActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=+RC[-5]*RC[-3]"
'Fill Down Active Column
End Sub
View 3 Replies
View Related
Jan 31, 2009
Is there a formula in Excel that returns the active cell address (ie dynamically). Excel updates the activecell address in the Name Box dynamically as you make a selection but I cannot find a standard formula to access it. I know I can achieve this with code using the selection-change event but this action then disallows use of the Undo button - which I specifically want to avoid. Perhaps there is an add-in available?
View 9 Replies
View Related
Jun 20, 2007
I want to insert a new row that contains the formulas of a fixed row (1:1).
The inserted row is changeable and is determined by whichever is the current active cell.
Eg:
Active cell is something random like E16
I want to add a new row but don't want a blank row - rather want a row that contains the properties of 1:1
View 9 Replies
View Related
May 31, 2014
I am having some difficulties using a combination of IF and the OFFSET function to display a range of cell values from another column based on a simple condition. The values I need to display at the destination cells should be offset by 8 columns to the right and "X" rows down from the reference column. The value "X" is to be determined via the IF function to check for the row index number.
For example, if Index value "X" = 8, then display the value of B2 in cell I9. IF X = "9", display B2 in cell I10 etc.
I have attached a sample worksheet that provides some examples.
View 3 Replies
View Related
Apr 20, 2012
I am trying to create an active cell formula based of variables from given cells.
With ActiveCell.FormulaR1C1 = "=CONCATENATE(""RU"",RC[-12],RC[-11],RC[-10],RC[-9])-CONCATENATE(""MU"",RC[-12],RC[-11],RC[-10],RC[-9])"
ActiveCell.Formula = ActiveCell.Value
But This does nothing.
View 5 Replies
View Related
Mar 20, 2014
I am trying to apply icon conditional formatting in a cell. The cell contains the following formula: =VLOOKUP(D20,'owssvr(1)'!O:W,9,FALSE The formula results in a "2", "1", "0" or "-1" in the cell. The icon conditional formatting is not working at all (no icon appears). I have the conditional formatting setup as numbers Green 2, Yellow 1,0 etc based on value. If I delete the formula and just type in any of those numbers directly, it works. I have changed my cells to "number" and it still does not work.
View 3 Replies
View Related