Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Combine IsNumeric & CountA in single If statement

With the IsNumeric test, it returns "Yes" for a blank cell otherwise works OK.
How to not see blank as IsNumeric?

For Each c In aRng
If IsNumeric(c.Offset(, 3)) Then
MsgBox "Yes"
End If
Next

With the CountA test, it works just fine, returns "8" if Resize range is 'full'.

For Each c In aRng
If WorksheetFunction.CountA(c.Resize(1, 8)) = 8 Then
MsgBox "8"
End If
Next


Then with a corrected IsNumeric test and the CountA test, how to put in a single:

For Each c In aRng
If CountA... and IsNumeric... Then
'Do something
End If
Next

Thanks.
Howard
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Combine IsNumeric & CountA in single If statement

Hi Howard,

Am Sat, 2 Aug 2014 23:01:11 -0700 (PDT) schrieb L. Howard:

With the IsNumeric test, it returns "Yes" for a blank cell otherwise works OK.
How to not see blank as IsNumeric?


if you only want to check c then:

For Each c In aRng
If Len(c) 0 And IsNumeric(c) Then
'Do something
End If
Next

If you want to check the resized range also:

For Each c In aRng
If WorksheetFunction.CountA(c.Resize(, 8)) = 8 _
And IsNumeric(c) Then
'Do something
End If
Next


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Combine IsNumeric & CountA in single If statement

if you only want to check c then:



For Each c In aRng

If Len(c) 0 And IsNumeric(c) Then

'Do something

End If

Next



If you want to check the resized range also:



For Each c In aRng

If WorksheetFunction.CountA(c.Resize(, 8)) = 8 _

And IsNumeric(c) Then

'Do something

End If

Next

Regards

Claus B.

--


Hi Claus,

I need to check the Offset(, 3) if it alone is numeric so I added it to your suggestion, plus the resize CountA range needs to equal 8.

Looks like it is spot on and I would swear I tried the same as I have posted here below and it would not compile, trying the "&" and "And", it was giving me fits.


If WorksheetFunction.CountA(c.Resize(, 8)) = 8 _
And IsNumeric(c.Offset(, 3)) Then
'Do something
End If
Next

I'm on track now, Thanks a ton.

Howard
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
Combine Bar with Single Line Chart [email protected] Charts and Charting in Excel 5 January 10th 08 05:55 PM
combine CountA and CountIf RB Smissaert Excel Programming 14 October 5th 06 02:02 PM
combine the two into a single formula please Steved Excel Worksheet Functions 3 September 8th 05 01:31 AM
how to combine several columns into a single column jims Excel Discussion (Misc queries) 9 August 15th 05 12:00 PM
CountA formula with an IF statement Teri Excel Worksheet Functions 1 November 15th 04 10:11 PM


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