LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested IFs Pieyed Piper Excel Worksheet Functions 1 November 9th 09 12:04 AM
nested if Gary Wessle Excel Worksheet Functions 6 August 2nd 07 05:19 AM
nested if based on nested if in seperate sheet. how? scouserabbit Excel Worksheet Functions 5 March 2nd 07 04:03 PM
Nested IF Keith in Australia Excel Discussion (Misc queries) 3 August 22nd 05 04:44 AM
What is quicker? Nested or non nested ifs andycharger[_17_] Excel Programming 2 February 25th 04 03:58 PM


All times are GMT +1. The time now is 09:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"