Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default only display positive values

I have a spreadsheet that forecasts based on history, unfortunately where
there have been negative sales the formula creates a negative forecast which
I want to read as zero. I am using the macro below

thanks

Dim i As Long
For i = 31 To Application.ActiveSheet.UsedRange.Rows.Count

If Not Cells(i, "V").Locked Then _
Cells(i, "V").FormulaR1C1 = "=SUM(RC15:RC17)/3"
Cells(i, "V").Copy
If Not Cells(i, "V").Locked Then _
Cells(i, "V").PasteSpecial Paste:=xlValues
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default only display positive values

Try an IF statement in your formula:

Cells(i, "V").FormulaR1C1 = "=IF(SUM(RC15:RC17)/3<0,0,SUM(RC15:RC17)/3)"

Mike F

"Michael" wrote in message
...
I have a spreadsheet that forecasts based on history, unfortunately where
there have been negative sales the formula creates a negative forecast
which
I want to read as zero. I am using the macro below

thanks

Dim i As Long
For i = 31 To Application.ActiveSheet.UsedRange.Rows.Count

If Not Cells(i, "V").Locked Then _
Cells(i, "V").FormulaR1C1 = "=SUM(RC15:RC17)/3"
Cells(i, "V").Copy
If Not Cells(i, "V").Locked Then _
Cells(i, "V").PasteSpecial Paste:=xlValues



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default only display positive values

Cells(i, "V").FormulaR1C1 = "=IF(SUM(RC15:RC17)<0,0,SUM(RC15:RC17)</3)"
--
- K Dales


"Michael" wrote:

I have a spreadsheet that forecasts based on history, unfortunately where
there have been negative sales the formula creates a negative forecast which
I want to read as zero. I am using the macro below

thanks

Dim i As Long
For i = 31 To Application.ActiveSheet.UsedRange.Rows.Count

If Not Cells(i, "V").Locked Then _
Cells(i, "V").FormulaR1C1 = "=SUM(RC15:RC17)/3"
Cells(i, "V").Copy
If Not Cells(i, "V").Locked Then _
Cells(i, "V").PasteSpecial Paste:=xlValues

Reply
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
Automatic display positive or negative tran1728 Excel Discussion (Misc queries) 3 May 8th 10 11:34 AM
how do i display a variance in all positive numbers? Susan Excel Worksheet Functions 2 June 26th 06 04:24 PM
Formula to make Negative Values Positive & Positive Values Negative? mustard Excel Discussion (Misc queries) 4 September 26th 05 10:05 PM
... Count, <<< Positive Values minus Negative Values >>> ... Dr. Darrell Excel Worksheet Functions 4 September 8th 05 01:36 PM
Multiply (C8-C4) by B10 to display positive only i.e. C8>=C4 seamusdoherty New Users to Excel 3 May 4th 05 04:44 PM


All times are GMT +1. The time now is 05:40 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"