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

Hello,

My problem is that I don't know weather the sumif returns zero because
there is no value is the choosen lines or the total sum of choosen
lines values is zero.

For example:

Case 1:
group value
A 0
A

sumif which sums values for group A lines will return: 0

Case 2:
group value
A
A

sumif which sum values for group A lines will return: 0

How can I check wheather all choosen lines are empty ?

Thank you for yor help
Gil D.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sumif problem


Try:
[If your using formulas, put this under the two cells you want to
add]:
=If (or(isblank([cell1]) = TRUE, isblank([cell2])), "One is Blank",
sum([your cell range]))

[If VBA]:
if Sheet[x].range("[a]").value = "" or Sheet[x].range("b]").value = ""
then
msgbox("One is Blank")
Else
Sheet[x].range("[c]").value = Sheet[x].range("[a]").value +
sheet[x].range("[b]").value
end if


--
jasonsweeney
------------------------------------------------------------------------
jasonsweeney's Profile: http://www.excelforum.com/member.php...fo&userid=5222
View this thread: http://www.excelforum.com/showthread...hreadid=508584

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Sumif problem

Hello,

Thank you for your help.

My problem is that I have max 15 rows that I should check.

How can I use isBlank for a range ?

Thank you
Gil D.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sumif problem


Use a Macro:
-- Assumes your data is in Column "B"
-- Assumes your data starts in row 1
-- Places sum results in Cell B16
-- Places blank results in Cell C16
_______________

sub check_for_blanks()
' Set your results to zero
Sheet1.cells(16,2).value = 0
Sheet1.cells(16,3).value = 0
' loop through the cells
For i = 1 to 15
If Sheet1.cells(i,2).value = "" then
Sheet1.cells(i,3).value = "Is Blank"
Sheet1.cells(16,3).value = Sheet1.cells(16,3).value + 1
Else
Sheet1.cells(16,2).value = Sheet1.cells(16,2).value +
sheet1.cells(i,2).value
End if
Next
end sub


--
jasonsweeney
------------------------------------------------------------------------
jasonsweeney's Profile: http://www.excelforum.com/member.php...fo&userid=5222
View this thread: http://www.excelforum.com/showthread...hreadid=508584

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Sumif problem

Hello,

jasonsweeney - thank you for your help.

I'm trying first Tom Ogilvy suggestion because I prefer using a
formula.

Thank you
Gil D.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Sumif problem

jasonsweeney thank you.

I prefer using a formula so I'm trying (first) Tom Ogilvy suggestion.

Thank you
Gil D.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sumif problem

Use countif to check.

--
Regards,
Tom Ogilvy


"Gil D." wrote in message
ups.com...
Hello,

My problem is that I don't know weather the sumif returns zero because
there is no value is the choosen lines or the total sum of choosen
lines values is zero.

For example:

Case 1:
group value
A 0
A

sumif which sums values for group A lines will return: 0

Case 2:
group value
A
A

sumif which sum values for group A lines will return: 0

How can I check wheather all choosen lines are empty ?

Thank you for yor help
Gil D.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sumif problem

Sorry, misread your question

=Sumproduct(--(A1:A10="A"),--(B1:B10)="")

will give you the number of blanks.
--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Use countif to check.

--
Regards,
Tom Ogilvy


"Gil D." wrote in message
ups.com...
Hello,

My problem is that I don't know weather the sumif returns zero because
there is no value is the choosen lines or the total sum of choosen
lines values is zero.

For example:

Case 1:
group value
A 0
A

sumif which sums values for group A lines will return: 0

Case 2:
group value
A
A

sumif which sum values for group A lines will return: 0

How can I check wheather all choosen lines are empty ?

Thank you for yor help
Gil D.





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Sumif problem

Hello,

I don't know how to use countif to check it.
I need to check which rows in the group-column = "A" (for example)
and then if all the rows in the value-column are empty.

How can I do this ?

Case 1 (Some group A rows are not empty):

group,value
A,0
A,0
B,3
A,0
B,8
C,5
A
..
..
..


Case 2 (All group A rows are empty):

group,value
A
A
B,3
A
B,8
C,5
A
..
..
..


Thank you
Gil D.

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sumif problem

=if(countif(A1:A10,"A")-Sumproduct(--(A1:A10="A"),--(B1:B10)="")=0,"All
blank",if(Sumproduct(--(A1:A10="A"),--(B1:B10)="")0,"some blank","none
blank"))

--
Regards,
Tom Ogilvy

"Gil D." wrote in message
oups.com...
Hello,

I don't know how to use countif to check it.
I need to check which rows in the group-column = "A" (for example)
and then if all the rows in the value-column are empty.

How can I do this ?

Case 1 (Some group A rows are not empty):

group,value
A,0
A,0
B,3
A,0
B,8
C,5
A
.
.
.


Case 2 (All group A rows are empty):

group,value
A
A
B,3
A
B,8
C,5
A
.
.
.


Thank you
Gil D.





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Sumif problem

Hello,

Thank you for your help.

I am trying to do what you have suggested but I think that Sumproduct
returns wrong values.

row, group (columnA), value(columnB)
1,A,6
2,A,Null
3,B,6
4,A,Null
5,A,Null
6,C,9
7,C,7
8,C,5
9,C,5
10,D,3

=SUMPRODUCT(--(A1:A10="A"),--(B1:B10)="") returns zero.

What is wrong ?

Thank you
GIl D.

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sumif problem

Sorry, had a typo in the sumproduct formula. Should be:

=SUMPRODUCT(--(A1:A10="A"),--(B1:B10=""))

--
Regards,
Tom Ogilvy


"Gil D." wrote in message
oups.com...
Hello,

Thank you for your help.

I am trying to do what you have suggested but I think that Sumproduct
returns wrong values.

row, group (columnA), value(columnB)
1,A,6
2,A,Null
3,B,6
4,A,Null
5,A,Null
6,C,9
7,C,7
8,C,5
9,C,5
10,D,3

=SUMPRODUCT(--(A1:A10="A"),--(B1:B10)="") returns zero.

What is wrong ?

Thank you
GIl D.



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
Another Sumif problem Jessejames Excel Worksheet Functions 1 May 8th 10 10:50 AM
SUMIF problem Hoyos Excel Discussion (Misc queries) 0 September 6th 07 06:30 PM
SumIF problem Emile Excel Worksheet Functions 4 October 15th 06 04:02 AM
=SUMIF Problem doctorjones_md Excel Discussion (Misc queries) 1 July 8th 06 08:32 AM
SUMIF problem Carla Bradley Excel Worksheet Functions 1 March 31st 05 11:10 PM


All times are GMT +1. The time now is 07:40 PM.

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

About Us

"It's about Microsoft Excel"