ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   difficulty with logical - if - and (https://www.excelbanter.com/excel-programming/277621-difficulty-logical-if.html)

billabong

difficulty with logical - if - and
 
I'm encountering difficulty with the following in VBA:

Quantity = cell B1
Price = cell B3
Gross amount = cell B5

How can I write the following logical if statement as follows:

If B1 is greater than 1, and B2 is greater than .0001, then (multiply
both together in B5, or else leave blank.

Thank you in advance.
Manuel

Alan Beban[_3_]

difficulty with logical - if - and
 
Assuming that B2 below was a typo,

=IF(AND(B11,B3.0001),B1*B3,"")

Alan Beban

billabong wrote:
I'm encountering difficulty with the following in VBA:

Quantity = cell B1
Price = cell B3
Gross amount = cell B5

How can I write the following logical if statement as follows:

If B1 is greater than 1, and B2 is greater than .0001, then (multiply
both together in B5, or else leave blank.

Thank you in advance.
Manuel



Jean-Paul Viel

difficulty with logical - if - and
 
Hi,

If Range("b2").Value 1 And Range("b2").Value 0.0001 Then
Range("b5").Value = Range("b1").Value * Range("b2").Value
End If



--
JP

http://www.solutionsvba.com


<billabong wrote in message
...
I'm encountering difficulty with the following in VBA:

Quantity = cell B1
Price = cell B3
Gross amount = cell B5

How can I write the following logical if statement as follows:

If B1 is greater than 1, and B2 is greater than .0001, then (multiply
both together in B5, or else leave blank.

Thank you in advance.
Manuel




Tom Ogilvy

difficulty with logical - if - and
 
What's in B2?

I assume you mean B3 when you say B2. Otherwise, replace all the B3 with
B2.

=if(And(B11,B3.0001),B3*B1,"")

--
Regards,
Tom Ogilvy

<billabong wrote in message
...
I'm encountering difficulty with the following in VBA:

Quantity = cell B1
Price = cell B3
Gross amount = cell B5

How can I write the following logical if statement as follows:

If B1 is greater than 1, and B2 is greater than .0001, then (multiply
both together in B5, or else leave blank.

Thank you in advance.
Manuel




billabong

difficulty with logical - if - and
 
On Sat, 20 Sep 2003 17:20:16 -0400, "Jean-Paul Viel"
wrote:

Hi,

If Range("b2").Value 1 And Range("b2").Value 0.0001 Then
Range("b5").Value = Range("b1").Value * Range("b2").Value
End If


Hello:
I've entered the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("b2").Value 1 And Range("b2").Value 0.0001 Then
Range("b5").Value = Range("b1").Value * Range("b2").Value
End If
End Sub


However nothing appears in cell B5
even though I entered 4 in cell B1 and 1 in cell B2 on the
spreadsheet.

Thank you, Manuel

billabong

difficulty with logical - if - and
 
On Sat, 20 Sep 2003 17:20:16 -0400, "Jean-Paul Viel"
wrote:

Hi,

If Range("b2").Value 1 And Range("b2").Value 0.0001 Then
Range("b5").Value = Range("b1").Value * Range("b2").Value
End If



Please disregard my last posting, it works perfectly, thank you,
I just entered those variables in cells A1 and A2 instead of B1 and
B2. ooops...

Manuel


All times are GMT +1. The time now is 12:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com