Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default expanding sumif

Hello everyone,
I have a bit of a problem expanding the formula below to
show when sales exceed 50. I do not want it to report
when it is less than 50. The formula sumif all sales and
their values. I will like for it to report in the next
row say column H. Sales exceeded by whatever number. Eg.
If sumif total is 60 and want it to report "Sales
exceeded by 10". Even just the number will do. Thanks for
any help and attempt in advance.

c.Offset(1, 3).Formula = "=Sumif(" & rng1.Offset(0,
3).Address & _
",""Sales""," & rng1.Offset(0,
4).Address & ")"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default expanding sumif

Are you Paul, too?

Didn't this work?

How about a formula that looks like:

=if(sumif()50,sumif()-50,0)

But an equivalent (and easier to write):
=max(0,sumif()-50)

So your code could look like:

Option Explicit
Sub testme()

Dim c As Range
Dim Rng1 As Range

'test locations
Set c = ActiveSheet.Range("d9")
Set Rng1 = ActiveSheet.Range("e9:e55")

c.Offset(6, 3).Formula = "=max(0,Sumif(" & Rng1.Offset(0, 3).Address & _
","" General items ""," & Rng1.Offset(0, 4).Address & ")-50)"
End Sub



chris wrote:

Hello everyone,
I have a bit of a problem expanding the formula below to
show when sales exceed 50. I do not want it to report
when it is less than 50. The formula sumif all sales and
their values. I will like for it to report in the next
row say column H. Sales exceeded by whatever number. Eg.
If sumif total is 60 and want it to report "Sales
exceeded by 10". Even just the number will do. Thanks for
any help and attempt in advance.

c.Offset(1, 3).Formula = "=Sumif(" & rng1.Offset(0,
3).Address & _
",""Sales""," & rng1.Offset(0,
4).Address & ")"


--

Dave Peterson

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
Expanding Text Box Marc Excel Discussion (Misc queries) 1 March 25th 08 04:52 PM
expanding results CheekyChappie Excel Discussion (Misc queries) 5 January 15th 07 04:15 PM
Expanding on a formula MartinW Excel Worksheet Functions 4 April 20th 06 01:06 PM
Expanding and Collapsing QPapillon Excel Discussion (Misc queries) 2 March 31st 06 09:41 PM
Expanding data Excels Cracking me up! Excel Worksheet Functions 2 November 9th 05 02:07 PM


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