Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Nesting ,Ands

=IF(AND(B2="Amount",C2<0),C2,IF(AND(B2="Amount",C 2=0,H2<0),"DIRECT",9))

Hi, Im trying to incorporate the above formula into a macro (below) but am
having
some problems with the elses and nesting.

For i = 1 to 100

f Cells(i, 2) = "Amount" Then
If Cells(i, 3) < 0 Then
Cells(i, 10) = Cells(i, 3)
Else
Cells(i, 10) = ".5"

End If
End If

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Nesting ,Ands

It's unclear exactly what you are trying to do.

The code does not match the formula. There is no reference to J2 in the
formula and no reference to DIRECT in the code. Also, there is no "next" to
go with the "For".

Can you elaborate, then maybe you will get some useful help.

Ian

"teresa" wrote in message
...
=IF(AND(B2="Amount",C2<0),C2,IF(AND(B2="Amount",C 2=0,H2<0),"DIRECT",9))

Hi, Im trying to incorporate the above formula into a macro (below) but am
having
some problems with the elses and nesting.

For i = 1 to 100

f Cells(i, 2) = "Amount" Then
If Cells(i, 3) < 0 Then
Cells(i, 10) = Cells(i, 3)
Else
Cells(i, 10) = ".5"

End If
End If

End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Nesting ,Ands

The formula is actually in thre J column in my worksheet - i just want to
extend
it to all J cells, the code I have given is a start but I want it like the
original formula

Thanks a lot

"IC" wrote:

It's unclear exactly what you are trying to do.

The code does not match the formula. There is no reference to J2 in the
formula and no reference to DIRECT in the code. Also, there is no "next" to
go with the "For".

Can you elaborate, then maybe you will get some useful help.

Ian

"teresa" wrote in message
...
=IF(AND(B2="Amount",C2<0),C2,IF(AND(B2="Amount",C 2=0,H2<0),"DIRECT",9))

Hi, Im trying to incorporate the above formula into a macro (below) but am
having
some problems with the elses and nesting.

For i = 1 to 100

f Cells(i, 2) = "Amount" Then
If Cells(i, 3) < 0 Then
Cells(i, 10) = Cells(i, 3)
Else
Cells(i, 10) = ".5"

End If
End If

End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Nesting ,Ands

If I've understood correctly then I think this will work, though I don't
know where you got your 0.5 in your code.
For i = 1 To 12
If Cells(i, 2) = "Amount" Then
If Cells(i, 3) < 0 Then
Cells(i, 10) = Cells(i, 3) 'If B=Amount,C<0 then J=C
ElseIf Cells(i, 8) < 0 Then
Cells(i, 10) = "DIRECT" 'If B=Amount,C=0 then J=DIRECT
Else
Cells(i, 10) = 9 'If B=AmountC=0,H=0 then J=9
End If
Else
Cells(i, 10) = 9 'If B<Amount then J=9
End If
Next

Ian

"teresa" wrote in message
...
The formula is actually in thre J column in my worksheet - i just want to
extend
it to all J cells, the code I have given is a start but I want it like the
original formula

Thanks a lot

"IC" wrote:

It's unclear exactly what you are trying to do.

The code does not match the formula. There is no reference to J2 in the
formula and no reference to DIRECT in the code. Also, there is no "next"
to
go with the "For".

Can you elaborate, then maybe you will get some useful help.

Ian

"teresa" wrote in message
...
=IF(AND(B2="Amount",C2<0),C2,IF(AND(B2="Amount",C 2=0,H2<0),"DIRECT",9))

Hi, Im trying to incorporate the above formula into a macro (below) but
am
having
some problems with the elses and nesting.

For i = 1 to 100

f Cells(i, 2) = "Amount" Then
If Cells(i, 3) < 0 Then
Cells(i, 10) = Cells(i, 3)
Else
Cells(i, 10) = ".5"

End If
End If

End Sub







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
3 ANDS + 1 OR Gator Girl Excel Discussion (Misc queries) 3 March 6th 09 01:53 AM
Multiple Nested IFs, ORs, Ands Shelly Excel Worksheet Functions 5 January 9th 07 01:07 AM
Multiple ifs, and ands, and are not working A.R.J Allan Jefferys Excel Discussion (Misc queries) 3 September 2nd 06 12:58 AM
Ifs and Ands - I'm confused! C Tate Excel Worksheet Functions 3 February 22nd 06 09:40 PM
Conditional Statement with ANDs Stephen Excel Discussion (Misc queries) 2 April 11th 05 04:41 PM


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