Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default How can I test for nulls within a range without specifying each ce

This is my (disgustingly beginner's) function:

=IF(AND('Worksheet2'!A5:A12="", 'Worksheet2'!B5:B12=""), "Both Columns
Null", IF(AND('Worksheet2'!A5:A12<"", 'Worksheet2'!B5:B12=""), "All of
column A range populated", "Some of Column B range populated"))

The important part is where I am specifying the range in a different
worksheet ('Worksheet2'!A5:A12="") and testing the cells for nulls. The rest
of the function is just retesting the same cells for different null
conditions and displaying different values in the field dependant on the
results. I am assuming that when I specify the range, Excel first calculates
the total value of the range, then tests that total value for a null?

If this assumption is correct, how can I tell Excel to test each cell on a
different worksheet within a range for a null value, without doing the
painstaking A5="", A6="", A7="", A8="", etc. Terribly error prone and a
maintenance nightmare, tell me what I'm doing wrong! :D
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How can I test for nulls within a range without specifying each ce

=counta(a5:a12)
will return the number of non-empty cells in A5:A12 -- even if the cells contain
formulas that evaluate to "" (empty strings).

So

=if(counta(a5:a12)=0,"All 8 cells are empty","At least one is non-empty")

If I wanted to check to see if all 8 cells are filled:

=if(counta(a5:a12)=8,"all filled","not all filled")





Houston wrote:

This is my (disgustingly beginner's) function:

=IF(AND('Worksheet2'!A5:A12="", 'Worksheet2'!B5:B12=""), "Both Columns
Null", IF(AND('Worksheet2'!A5:A12<"", 'Worksheet2'!B5:B12=""), "All of
column A range populated", "Some of Column B range populated"))

The important part is where I am specifying the range in a different
worksheet ('Worksheet2'!A5:A12="") and testing the cells for nulls. The rest
of the function is just retesting the same cells for different null
conditions and displaying different values in the field dependant on the
results. I am assuming that when I specify the range, Excel first calculates
the total value of the range, then tests that total value for a null?

If this assumption is correct, how can I tell Excel to test each cell on a
different worksheet within a range for a null value, without doing the
painstaking A5="", A6="", A7="", A8="", etc. Terribly error prone and a
maintenance nightmare, tell me what I'm doing wrong! :D


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default How can I test for nulls within a range without specifying eac

Excellent, that's a much more efficient way of doing things. Thanks!!

"Dave Peterson" wrote:

=counta(a5:a12)
will return the number of non-empty cells in A5:A12 -- even if the cells contain
formulas that evaluate to "" (empty strings).

So

=if(counta(a5:a12)=0,"All 8 cells are empty","At least one is non-empty")

If I wanted to check to see if all 8 cells are filled:

=if(counta(a5:a12)=8,"all filled","not all filled")





Houston wrote:

This is my (disgustingly beginner's) function:

=IF(AND('Worksheet2'!A5:A12="", 'Worksheet2'!B5:B12=""), "Both Columns
Null", IF(AND('Worksheet2'!A5:A12<"", 'Worksheet2'!B5:B12=""), "All of
column A range populated", "Some of Column B range populated"))

The important part is where I am specifying the range in a different
worksheet ('Worksheet2'!A5:A12="") and testing the cells for nulls. The rest
of the function is just retesting the same cells for different null
conditions and displaying different values in the field dependant on the
results. I am assuming that when I specify the range, Excel first calculates
the total value of the range, then tests that total value for a null?

If this assumption is correct, how can I tell Excel to test each cell on a
different worksheet within a range for a null value, without doing the
painstaking A5="", A6="", A7="", A8="", etc. Terribly error prone and a
maintenance nightmare, tell me what I'm doing wrong! :D


--

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
Handling nulls found in expression CW Excel Discussion (Misc queries) 1 February 13th 09 04:41 PM
Test within a range? JC Excel Worksheet Functions 3 May 25th 07 03:41 AM
replace zeros with nulls dharshanie Excel Discussion (Misc queries) 4 March 31st 06 04:10 PM
replace zeros with nulls dharshanie Excel Discussion (Misc queries) 0 March 31st 06 02:03 PM
average cells omitting nulls average-gal Excel Worksheet Functions 1 March 10th 05 08:14 PM


All times are GMT +1. The time now is 08:55 AM.

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"