Two conditions in IF statement

Hello,

I am trying to write a macro which uses If statements subject to two
logic checks.

Example

Sub test()
IF(A3>=B3 & A3<=C3) Then
Range("B7").Select
Selection.Copy
....
End IF
End Sub

Any help on this is much appreciated.  Thanks

0
6/24/2005 7:50:30 PM
excel 39879 articles. 2 followers. Follow

3 Replies
539 Views

Similar Articles

[PageSpeed] 42

One way:

    Public Sub Test()
        If Range("A3").Value >= Range("B3").Value And _
                Range("A3").Value <= Range("C3").Value Then
            Range("B7").Copy
            '...
        End If
    End Sub



In article <1119642630.549774.305010@g14g2000cwa.googlegroups.com>,
 tushargarg729@yahoo.com wrote:

> Hello,
> 
> I am trying to write a macro which uses If statements subject to two
> logic checks.
> 
> Example
> 
> Sub test()
> IF(A3>=B3 & A3<=C3) Then
> Range("B7").Select
> Selection.Copy
> ...
> End IF
> End Sub
> 
> Any help on this is much appreciated.  Thanks
0
jemcgimpsey (6723)
6/24/2005 8:19:33 PM
Hi

Sub aaa()
    If Range("A3").Value >= Range("B3").Value And Range("A3").Value <=
Range("C3").Value Then
        Range("B7").Copy
    End If
End Sub


Doug

tushargarg729@yahoo.com wrote in message
<1119642630.549774.305010@g14g2000cwa.googlegroups.com>...
>Hello,
>
>I am trying to write a macro which uses If statements subject to two
>logic checks.
>
>Example
>
>Sub test()
>IF(A3>=B3 & A3<=C3) Then
>Range("B7").Select
>Selection.Copy
>...
>End IF
>End Sub
>
>Any help on this is much appreciated.  Thanks
>


0
dug4xl (12)
6/25/2005 7:04:08 PM
Guys,

you guys saved my butt.  thanks for all your help.

Tushar

0
6/27/2005 1:35:36 AM
Reply:

Similar Artilces:

Conditional Formatting Pivottables
I am linking to SQL server and creating a pivottable in Excel '07 with the data that's returned. I would like to highlight a row when the last data column is 1.5 times greater than the total for that row. I can apply the initial conditional format I want and it works fine, but if I refresh the data the conditional format gets messed up. It will either completely disappear or will highlight the wrong area, or not the whole area. Is there a certain way conditional formatting has to be applied to pivottables? Thanks in advance for your help! ...

#N/A Can a conditional format change this to a white font?
#N/A Can a conditional format change this to a white font? Since I have cell B7 Linked from another worksheet and I have trie =B7 format White and nothing happens Am I missing something here -- Message posted from http://www.ExcelForum.com Hi you could embed your current formula in an IF(ISNA( structure to "deal" with the #N/A error e.g. =IF(ISNA(your original formula),"",your original formula again) Cheers JulieD "RudeRam >" <<RudeRam.1c8246@excelforum-nospam.com> wrote in message news:RudeRam.1c8246@excelforum-nospam.com... > #N/A Ca...

graph to show correlation btwn two data sets of different ranges.
I have variables a,b,&c for items 1-5. The range for these variables is 100-1000. There is a fourth varibale (d) that ranges from 1-12. I want to show in 1 graph that changes in variables a,b,&c are directly correlated to variable d. Here's what I am thinking: 1. Create a column graph for variables a,b,&c with the y axis label listed on the left. 2. Add a line graph of variable d with the y axis label on the right. Problem: - I have no idea how to add the line graph over the bar graphs. - I can't for the life of me figure out how to move the y axis label to the right side...

Conditional formatting, "0" not equal to blank
I would like the following conditional formatting A blank cell = no filling 0 to 0.99 = red 1 to 1.99 = yellow more than 2 = green The problem I have is that blank cells are red. I just want the cells where i type in "0" to be red. Is it possible to solve this problem? thanks! Try a formula of =AND(A1=0,LEN(A1)>0) -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Johan" <johan8830@hotmail.com> wrote in message news:1177417995.727500.270520@u32g2000prd.googlegroups.com... >I would like the following co...

help with nested iif statement
I have a table and I want to create a query that has a new field " Type of Shipment" base on a field "Item Category" If the item category field equals ZDIR, ZTRN ...etc up to 23 different item categories the "Type of Shipment field will equal DIRECT else I would like it to return "Stock" Any help will be greatly appreciated. Thanks Hi, for the iif statement. What you can do is: IIf(category = 'ZDIR' OR category = 'ZTRN' OR .............,'DIRECT','') Having a long nested if is a headache. What i can suggest ...

To apply trucate in select statement
I have the following data in table Worktime --------------- 5.30 6.40 3.15 5.55 How I give trucate function in select statement. ie, select sum(trucate(worktime,60)) .... Please help "pol" <pol@discussions.microsoft.com> wrote in message news:C67DCA08-A754-4434-94E0-CF81EFA29C04@microsoft.com... > I have the following data in table > > Worktime > --------------- > 5.30 > 6.40 > 3.15 > 5.55 > > How I give trucate function in select statement. ie, > select sum(trucate(worktime,60)) .... > > Please help ...

Help Conditional Formatting
Help: I'm using conditional formatting on some cells to highlight particular values. The conditional formatting on 2003 only allows 3 levels of conditional formatting. Anyone know if there is a way to increase the number of levels? Thanks for any advice. -- Dab Cut off: yourhead to respond Hi conditional format only accepts 3 conditions though you have a fourth if you include the default format. If you only want to apply different FONT colors based on NUMBERS, you can define up to 6 different styles. See: http://www.mcgimpsey.com/excel/conditional6.html for instructions how to do...

Print two reports 12-05-07
I havea table that holds customer that requested a Brochure and the brochures they require I have 3 Different brochures. I have a report based on a query to print out brochure letter end of each day, but what i would also like to do is that i have 3 different brochure and customer might request just one or all 3 so i would like to print out the report that has the price list for which ever brochure they have requested What i would like is a button that will print out the brochure letter for the first customer and then print out the report with the price list that the brochure they requested ...

Two different series
hello , can anyone help me plotting two different charts (line and column) on the plot ? i have two dataset with with different X series. When i plot the colum grph and the line graph the X values are not respected. For example the first series 1983 to 2000 and the second serie 2000 to 2003. When i plot i have my column series plot with data at 2000, the beginning of the second dataset. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ gomirage wrote: > hello , >...

how do I compare columns in two different workbooks?
I need to compare the information in one column of an excel workbook to another column of an excel workbook. Then need the system to report match or non-match. Thanks What exactly do you mean by a match? For example: If we are using cells A1:A10 and B1:B10, would be a match if the number '5' appeared in A1 and B5? Or, would the number '5' have to appear in A1 and B1 to constitute a match? If the match can be anywhere in the second column, this might do it: =IF(ISNA(VLOOKUP(A1,$B$1:$B$10,1,0)),"No Match","Match") If the match has to be in the same lo...

Two Results
Hi Guys!!! Basically when my data entry people enter a result I need the one single result to go into two different fileds For example having the date "29/01/08" go into the field Todays Date and the field Current Date In your form, use the AfterUpdate event procedure of the first text box to assign the value to the other one as well. Say you have text boxes named Date1 and Date2. In form design view, set the After Update property of Date1 to: [Event Procedure] Then click the Build button (...) beside this. Access opens the code window. Add this line between the Privat...

Show two rows as a fraction?
13% 0% 6% 100%: calculated from the 3rd and 4th rows 1/8 0/7 1/16 3/3: entered by operator 1 0 1 3: entered by operator 8 7 16 3: entered by operator I have a spreadsheet with lots of cells like these. The top ro contains a formula that divides the numbers in the third and fourt rows. The fraction in row 2 is entered by hand. The problem is tha the fraction is often not changed when updated numbers are entered. The higher-ups who get this report have a very low tolerance for error made by other people. So, I am wondering if there is a way that I ca present the numbe...

One user checking two account
I have a User(secretary) that need to check the email for a different email account (boss eamil). How do I tell Echcange to allow to view o authorize a user to see the email using only the Exchange connection for user 1 (secretary) Thanks Hi Carlos Try this article 262399 How to Delegate Mailbox Access in Active Directory http://support.microsoft.com/?id=262399 -- Hope this helps -- Melissa Travers, MCSE Microsoft Exchange Support Please do not send email directly to this alias. This alias is for newsgroup purposes only. This posting is provided "AS IS" with no warranties,...

Produce report from two queries from one table?
I am currently working upon a database which is being used to produce pricing qutoes. I have ran two queries to show item of products which have been quoted for and one which shows a sum of the remaing unquoted products. Each product is placed into different sections which relates to its main function, be it electrial or machineary. I am hoping to have a report which will allow me to show all quoted products under the sections, but have the unquoted products for the sections as one line entry in the report. I have ran a normal report showing full list details of both quoted and un-quo...

Better Way to Code IF Statements?
Is there a better way than this to code IF statements in a worksheet? Code: -------------------- =IF(H8=1, A1, IF(H8=2, A2, IF(H8=3, A3, A4))) -------------------- As the code shows, the common reference cell is H8 and the IF statement checks it's value (from a range of 1-3) and then makes the target cell equal one out of a range of cells depending on the outcome. This is a short example but I have some very long and complex IF statements that use this method and was wondering if there was a way to simplify e.g. by using array formulas or something similar? Something along the l...

Accounts Receivable Statements
When setting up AR Statements and using the email option the body of the email by default is blank. Is there any way to add standard text to the body of these emails? A salutation, contact info, etc? ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microso...

Extract String based on condition
How can I extraxt a string that begins with a certain number and is only X amount of digits long? Example: I need to extract where an "8" is found, and the next 6 spaces that immediately follow: fgte8575684vrdef - Resut should be 8575684 Any ideas? Thanks. =MID(A1,Find("8",A1),8) -- HTH RP (remove nothere from the email address if mailing direct) "Send Object Command - Two attachments" <SendObjectCommandTwoattachments@discussions.microsoft.com> wrote in message news:40EB7F18-F456-436A-A334-FA7340474D94@microsoft.com... > How can I extraxt a s...

Outlook/New Mail Rule: Add conditions that affect the BCC line
Outlook Express version 6 Junk email spammers like the Viagra, Rolex, and Stock Market emails victimize millions of recipients by using the "Bcc" line. Receiving spammed junk email that is not showing your email address in the "To" line usually shows a name you do not recognize, i.e, To: BogusName@msn.com. All the while, your real email address is being blind copied, i.e., Bcc: MyRealName@msn.com so you do not see it. Other than Blocking Senders, there is no other recourse that I know of. Please add a condition that will affect the Bcc line in Outlook. This will ce...

Whether Visio can compares the contecnt of two visio files??
This is a multi-part message in MIME format. ------=_NextPart_000_0011_01C56887.86406D10 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Whether Visio can compares the contecnt of two visio files?? ------=_NextPart_000_0011_01C56887.86406D10 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312"> <META conte...

Conditional Format Formula Needed
Hi All, I'm trying to say something like this =(C$9+30<$D$67)+H$9<>x, which is probably not close. I want to make a H9 red when its past due. It's past due when C9 is more than 30 days from the current date in D67 and not paid. It's paid when G9 has an x in it. C9 - date invoiced, i.e. 1/18/2007 (date format 18-Jan) D67 - current date, i.e. 3/14/2007 (date format 14-Mar) G9 - balance due, which should turn red if late H9 - paid there's an x in the cell (general format) Can anyone help with this formula? Thanks, Michele maybe... =and((c$9+30<$d$67),(H$9<...

Conditional formatting #55
Hi, Is the following possible with conditional formatting: If cell A1 is blank then the normal format for A2 (which has a list entry drop-down box) is a dark blue background and contains no text.. However if cell A1 contains the text "Miss" then cell A2 should have a background of light yellow, which indicates text entry required. Here's the bit When the text has been entered in A2 the cell background (of A2) should revert to dark blue with the text white. Can it be done?? Sandy Sandy wrote: > Hi, > Is the following possible with conditional formatting: > >...

linking two pages
I have seperate documents and then I put them all together into one as a completely different document. Can you link these two seperate documents and see all of the information instead of just a button that will take you to the linked doc? I want to make corrections to one doc and have the other doc update itself when it is opened but I do not want the link to appear as an icon. I have figured out how to do it in excel but I cannot seem to get it to work in Publisher. Is there a way to do it? ...

Publisher two-page view
I'm trying to figure out how to make the first page of a publisher file be a left page in a two-page spread, rather than a right-page without having to add a separate page. The newsletter I'm working on has 8 pages, but due to the graphics involved, it is nearly 60MB and I'm having trouble saving it to my server without errors. So, I want to break it apart into printer-ready sections (back cover the first, left-sided page in a two-page spread with the front cover being the second, right-sided page in a two-page spread). I've searched the help files & the discussio...

Join two formulas
I have this formula: =SUMPRODUCT(--(YEAR('2003-2004'!$A$4:$A$10000)=2004),--(MONTH('2003-2004'!$A $4:$A$10000)=2),'2003-2004'!$E$4:$E$10000) And I only want this to be true if: {=SUM((builder="m")*(servicedby="Dave")*nc)} I don't think it is as easy as joining two together, but I tried: =IF(((builder="m")*(servicedby="Dave")),(SUMPRODUCT(--(YEAR('2003-2004'!$A$4 :$A$10000)=2004,--(MONTH('2003-2004'!$A$4:$A$10000)=2),('2003-2004'!$E$4:$E$ 10000))),1)) I also tried: =SUMPRODUCT(--(YEAR('2003-2...

Two versions of Autoupdate, does not recognize new version.
After downloading the 2.1.1 update and installing it (due to the reason that AutoUpdate won't install it) I now have version 2.1.1 found in MACHD/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app However, this version of autoupdate is still asking me to instal 2.1.1, and does not allow me to update for other apps yet. I have found out that the version in my Office 2008 folder is still 2.1.0! How can i fix this problem? For now I still have to manually download and install the updates, which is quite a hassle! Here is the image of both my autoupdates' detecte...