Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Nested If/Then Help
I have a data set of three columns and 6000 rows, these columns represent the
last three months of sales actuals. In each column if a sale occurred then a number is in the cell, if not then the cell is blank. In another column I would like to perform a calculation using the most recent data. So if a sale occurred in last month then a number will be in the appropriate cell and I will use it, if the cell for last month is blank then I would like to use the data from the previous month, and so on. I wrote some simple code, but it is not working. The cell locations are correct as the data set is very large. Sub Netback() ' ' Netback Macro ' Macro recorded 7/18/2008 by Sasol NA User Range("bc81").Select ActiveCell.Select Do Until IsEmpty(ActiveCell([0], [-52]).Value) ActiveCell.Offset(1).Select If ActiveCell([0], [-13]).Value 0 Then ActiveCell.FormulaR1C1 = "=R[0]C[-13]/R[0]C[-37]" End If If ActiveCell([0], [-13]).Value = IsBlank And ActiveCell([0], [-14]).Value 0 Then ActiveCell.FormulaR1C1 = "=R[0]C[-14]/R[0]C[-38]" End If If ActiveCell([0], [-13]).Value = IsBlank And ActiveCell([0], [-14]).Value = IsBlank Then ElseIf ActiveCell([0], [-15]).Value 0 Then ActiveCell.FormulaR1C1 = "=R[0]C[-15]/R[0]C[-39]" Else: ActiveCell.Value = 0 End If Loop End Sub Help me find my obvious error. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Nested IFs | Excel Worksheet Functions | |||
nested if | Excel Worksheet Functions | |||
nested if based on nested if in seperate sheet. how? | Excel Worksheet Functions | |||
Nested IF | Excel Discussion (Misc queries) | |||
What is quicker? Nested or non nested ifs | Excel Programming |