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

Hi Im trying to use =(SUMIF(teams,Home,power)) with vba. teams,home
and power are named ranges. The calc works perfect in excel. Ive
tried
Dim xt As Double
xt = Application.WorksheetFunction.SumIf(Range("teams") , Range
("Home"), Range("Power"))
MsgBox xt.

The reason I want to do this is, in excel the calc is dependent on
other data, and when calculated I dont want the value to change, but
because its calc from other data which changes daily the value changes
to, so I thought Id calc using vba and write the value to appropiate
range then when values change this result wont. Basically its the
previous days result.
Thanks Regards Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default sumif in vba


Is Range("home") the criteria for the SUMIF?


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site' (http://www.excel-it.com/)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=102011

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default sumif in vba

On 31 May, 09:59, royUK wrote:
Is Range("home") the criteria for the SUMIF?

--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site' (http://www.excel-it.com/)
------------------------------------------------------------------------
royUK's Profile:http://www.thecodecage.com/forumz/member.php?userid=15
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=102011


thanks for replying. Yes it is.
Robert
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default sumif in vba


The code works for me on a dummy workbook.

Is Range("Home") a single cell?


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site' (http://www.excel-it.com/)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=102011

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default sumif in vba

Hi Robert,

The syntax you have used should work as can the one below:
xt = [SUMIF(teams,Home,power) ]

Check your named ranges to see if the ranges 'teams' and 'power' are the
same dimensions, and 'Home' holds a valid criteria.


Regards
Robert McCurdy
"RobcPettit" wrote in message
...
Hi Im trying to use =(SUMIF(teams,Home,power)) with vba. teams,home
and power are named ranges. The calc works perfect in excel. Ive
tried
Dim xt As Double
xt = Application.WorksheetFunction.SumIf(Range("teams") , Range
("Home"), Range("Power"))
MsgBox xt.

The reason I want to do this is, in excel the calc is dependent on
other data, and when calculated I dont want the value to change, but
because its calc from other data which changes daily the value changes
to, so I thought Id calc using vba and write the value to appropiate
range then when values change this result wont. Basically its the
previous days result.
Thanks Regards Robert



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
=SUMIF Kevin Excel Discussion (Misc queries) 4 January 26th 09 08:52 PM
sumif for multi conditions. i.e sumif(A1:A10,"Jon" and B1:B10,"A" Harry Seymour Excel Worksheet Functions 9 June 12th 07 10:47 PM
Embedding a Sumif in a sumif C.Pflugrath Excel Worksheet Functions 5 August 31st 05 07:31 PM
nested sumif or sumif with two criteria dshigley Excel Worksheet Functions 5 April 5th 05 03:34 AM
SUMIF - Range name to used for the "sum_range" portion of a SUMIF function Oscar Excel Worksheet Functions 2 January 11th 05 11:01 PM


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