Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 38
Default IF Statement Variable

I need to write an IF statement that will look at all the cells in a row, and
if it finds anything, letters or numbers, it then places a "1" in the AA
column of that row.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default IF Statement Variable

Try something along the lines of

Dim RowNum As Long
RowNum = 1 '<<< CHANGE AS REQUIRED
If Application.CountA(Rows(RowNum)) 0 Then
Cells(RowNum, "AA").Value = 1
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Jase4now" wrote in message
...
I need to write an IF statement that will look at all the cells in a row,
and
if it finds anything, letters or numbers, it then places a "1" in the AA
column of that row.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default IF Statement Variable

Try this formula in AA1:

=1*COUNTA(A1:Z1)0

or alternatively:

=IF(COUNTA(A1:Z1)0,"1","")

and copy down the columns for as many rows as you need to look at.

Hope this helps.

Pete

On Sep 25, 10:28 pm, Jase4now
wrote:
I need to write an IF statement that will look at all the cells in a row, and
if it finds anything, letters or numbers, it then places a "1" in the AA
column of that row.

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default IF Statement Variable

Or, if you'd prefer a formula:

=MIN(1,SUMPRODUCT(--(A1:Z1<"")))

or

=MIN(1,COUNTA(A1:Z1))

This second formula will consider a blank "" returned by a formula as a
value, whereas the first formula will not.

HTH,
Elkar


"Chip Pearson" wrote:

Try something along the lines of

Dim RowNum As Long
RowNum = 1 '<<< CHANGE AS REQUIRED
If Application.CountA(Rows(RowNum)) 0 Then
Cells(RowNum, "AA").Value = 1
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Jase4now" wrote in message
...
I need to write an IF statement that will look at all the cells in a row,
and
if it finds anything, letters or numbers, it then places a "1" in the AA
column of that row.

Thanks


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
How to pass a variable into an SQL statement CLamar Excel Discussion (Misc queries) 0 June 5th 06 02:17 PM
if than statement has too many variable repke New Users to Excel 1 May 2nd 06 02:00 PM
how can i calculate a three variable if statement in excel Jennifer Samuel Excel Worksheet Functions 2 February 13th 06 04:21 AM
testing more than one variable in an if statement Charles Excel Discussion (Misc queries) 3 February 22nd 05 06:46 PM
Add 2nd variable to if statement - ifAnd? Todd F. Excel Worksheet Functions 4 December 18th 04 07:49 PM


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