If Statement with Two Conditions

I'm trying to do an if statement with two conditions like the following

If a value falls between two dates then give it a value of 1, if not give it a value of 0.  The if statement works well with one condition but when I try to do something like this = if (a2<=b2<=c2,1,0) it does not work.  Help

Leroy
0
anonymous (74722)
5/19/2004 2:36:07 PM
excel.misc 78881 articles. 5 followers. Follow

5 Replies
537 Views

Similar Articles

[PageSpeed] 20

Leroy,

Try something like
=IF(AND(A2<=B2,B2<=C2),1,0)


-- 
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Leroy" <anonymous@discussions.microsoft.com> wrote in message
news:EF57802D-CA6F-4A45-95FB-9807FFEA19B5@microsoft.com...
> I'm trying to do an if statement with two conditions like the
following:
>
> If a value falls between two dates then give it a value of 1,
if not give it a value of 0.  The if statement works well with
one condition but when I try to do something like this = if
(a2<=b2<=c2,1,0) it does not work.  Help!
>
> Leroy


0
chip1 (1821)
5/19/2004 2:41:06 PM
Hi
try
=IF(AND(A1>=DATE(2004,1,1),A2<DATE(2004,4,1)),1,0)

--
Regards
Frank Kabel
Frankfurt, Germany


Leroy wrote:
> I'm trying to do an if statement with two conditions like the
> following:
>
> If a value falls between two dates then give it a value of 1, if not
> give it a value of 0.  The if statement works well with one condition
> but when I try to do something like this = if (a2<=b2<=c2,1,0) it
> does not work.  Help!
>
> Leroy

0
frank.kabel (11126)
5/19/2004 2:41:44 PM
The secret here is AND
AND
See Also

Returns TRUE if all its arguments are TRUE; returns FALSE if one or more
argument is FALSE.

Syntax

AND(logical1,logical2, ...)

Logical1, logical2, ...   are 1 to 30 conditions you want to test that can
be either TRUE or FALSE.

Remarks

  a.. The arguments must evaluate to logical values such as TRUE or FALSE,
or the arguments must be arrays or references that contain logical values.
  b.. If an array or reference argument contains text or empty cells, those
values are ignored.
  c.. If the specified range contains no logical values, AND returns the
#VALUE! error value.
Example 1

The example may be easier to understand if you copy it to a blank worksheet.

 How?

  1.. Create a blank workbook or worksheet.
  2.. Select the example in the Help topic. Do not select the row or column
headers.


  Selecting an example from Help

  3.. Press CTRL+C.
  4.. In the worksheet, select cell A1, and press CTRL+V.
  5.. To switch between viewing the results and viewing the formulas that
return the results, press CTRL+` (grave accent), or on the Tools menu, point
to Formula Auditing, and then click Formula Auditing Mode.


            1
            2
            3
            4
     A B
            Formula Description (Result)
            =AND(TRUE, TRUE) All arguments are TRUE (TRUE)
            =AND(TRUE, FALSE) One argument is FALSE (FALSE)
            =AND(2+2=4, 2+3=5) All arguments evaluate to TRUE (TRUE)


Example 2

The example may be easier to understand if you copy it to a blank worksheet.

 How?

  1.. Create a blank workbook or worksheet.
  2.. Select the example in the Help topic. Do not select the row or column
headers.


  Selecting an example from Help

  3.. Press CTRL+C.
  4.. In the worksheet, select cell A1, and press CTRL+V.
  5.. To switch between viewing the results and viewing the formulas that
return the results, press CTRL+` (grave accent), or on the Tools menu, point
to Formula Auditing, and then click Formula Auditing Mode.


            1
            2
            3
     A
            Data
            50
            104
            Formula Description (Result)
            =AND(1<A2, A2<100) Because 50 is between 1 and 100 (TRUE)
            =IF(AND(1<A3, A3<100), A3, "The value is out of range.")
Displays the second number above, if it is between 1 and 100, otherwise
displays a message (The value is out of range.)
            =IF(AND(1<A2, A2<100), A2, "The value is out of range.")
Displays the first number above, if it is between 1 and 100, otherwise
displays a message (50)


-- 
Don Guillett
SalesAid Software
donaldb@281.com
"Leroy" <anonymous@discussions.microsoft.com> wrote in message
news:EF57802D-CA6F-4A45-95FB-9807FFEA19B5@microsoft.com...
> I'm trying to do an if statement with two conditions like the following:
>
> If a value falls between two dates then give it a value of 1, if not give
it a value of 0.  The if statement works well with one condition but when I
try to do something like this = if (a2<=b2<=c2,1,0) it does not work.  Help!
>
> Leroy


begin 666 blueup.gif
M1TE&.#EA#@`*`,03```=B0``_Z6E[KVZ\JFFXPPHC]#.]@<`W]_A\00`Z@8`
MXI65_]#0_QT5VR0=VXN+_YJ:_[>W_________P``````````````````````
M`````````````````````````"'Y! $``!,`+ `````.``H```4K8(%,9&F2
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(09]Z,0G)B&**B)A%GO8E!]Z\8LB
M8<X2O\=%\IP1#FK4XHP(2+WQO"91>LM9(P9G"!\]SI&/?91CP0!)G@IB8H6$
MC!V6\L3(1CJ2%#\(`@`[````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
<````````````````````````````````````````
`
end

0
Don
5/19/2004 2:43:30 PM
Hi Leroy,
You need to use the AND function.
=IF(AND(a2>=b2,a2<=c2),1,0)

-- 
Bernard Liengme
www.stfx.ca/people/bliengme
remove CAPS in e-mail address


"Leroy" <anonymous@discussions.microsoft.com> wrote in message
news:EF57802D-CA6F-4A45-95FB-9807FFEA19B5@microsoft.com...
> I'm trying to do an if statement with two conditions like the following:
>
> If a value falls between two dates then give it a value of 1, if not give
it a value of 0.  The if statement works well with one condition but when I
try to do something like this = if (a2<=b2<=c2,1,0) it does not work.  Help!
>
> Leroy


0
bliengme5824 (3040)
5/19/2004 2:43:32 PM
Hi Leroy!

The syntax for testing for two conditions that must both be met and to 
return 1 for TRUE and 0 for FALSE is:

=IF(AND(Condition1,Condition2),1,0)

So you need something like:

=IF(AND(C2>=A2,C2<=B2),1,0)

Covers C2 being between A2 and B2 inclusive of those two dates.
-- 
Regards
Norman Harker MVP (Excel)
Sydney, Australia
njharker@optusnet.com.au 


0
njharker (1646)
5/19/2004 2:51:25 PM
Reply:

Similar Artilces:

Setup Question
I am having trouble finding clear information and advice about how to set up my Money file. I would like to set up Money so that my girlfriend and I can track bank accounts, investments and expenses that we have jointly (including our mortgage and rental property). However, we also both have separate bank accounts, investments and expenses that are unrelated to each other. I don't know whether I should set up two separate files or set up all of our information in one file that we have to share. I really want to avoid having to enter our shared accounts and expenses twice, so ...

Income Statements in FRx
When creating the Balance Sheet, I can use Account Type (which links to the Great Plains 'Category' field on the Account Maintenance screen) as opposed to specifying all accounts to pull and summarize information. This helps ensure that when I add a new account to GP, that it will be included automatically on my report. For the Income Statement, I would like to to use Account Type also, but I would like for it to detail all accounts, instead of just a summary. For instance, instead of looking like this: Expenses Operating Expense Administrative Expense I want the deta...

merging two cells without loosing data
If i have data in cell a1 that says "1234 brown st" and data in cell a2 that says "Anytown, WY 12345", how do I merge the two cells and not loose any data so that cell a1 will have the value "1234 brown st Anytown, WY 12345" ??????? I'd use a helper column of cells and hide column A: =a1&" "&b1 I'd keep the data as granular as possible. It's really easy to concatenate--but can get real hairy to separate. mm wrote: > > If i have data in cell a1 that says "1234 brown st" and data in cell a2 that > says "A...

$ format within if statement
I am using Microsoft Excel 2000 for a financial spreadsheet. I want to compare two different financial computations and see which is higher for each row. My "if" statement looks like this: =IF(G8>H8,"Category A is higher by $"&(G8-H8),"Category B is higher with $"&(H8-G8)) The problem is, sometimes the dollar amounts are showing with three decimal places, and I only want to show two for dollars. For example, it may say: "Category A is higher with $201.098" How do I get it to show only two decimal places? Thank you in advance for your h...

Conditional Formating based on another cell
I have 2 columns of concern DATE and COST. I would like the COST cell to be shaded if the DATE cell is less than a specificed date. Then if it is possible to calculate the COST field but only the ones highlighted. Help is greatly appreciated!! Thanks, Stacey For the conditional format, use the following for the condition of the cost column: =$A$2<TODAY() and so on, where cell A2 is the corresponding date column. Select the appropriate shade on the pattern tab. As far as calculating the cost column if it is highlighted, my only thoughts are to write a macro that you can run that c...

trying to concatenate two columns without removing leading zeros
A customer sent me a spreadsheet in an incorrect format for my purposes. I have about 13,000 records in Excel 2007 where I need to concatenate column 1 with column 2 to create the format I really need. The problem is that each of those columns contains numbers, and when I do an =a1&a2, if a1 contains 00123 and a2 contains 0121, I end up with 123121 when what I really need is 001230121. I've tried formatting the cells as text first without any luck. Any help would be greatly appreciated. Thanks! I'm not positive yet, but I *THINK* this may have worked. Let me see if when I o...

if than statement has too many variable
Hello I'm pretty much a novice at using Excel but made a formula a couple years ago to calculate freight. There are 2 basic scenarios, if the weight falls between a certain brackets it gets a set price or it gets multiplied by a percentage. I think the max number of if than statements is seven... correct? My excel file was corrupted about 3 months back and I have been unsuccessful in recreating it. I'm open to using a more appropriate formula or fixing the current one. Either way I appreciate the help. =IF(E4<=50,28,IF(E4<=305,42,IF(E4<=393,E4*0.1373,IF(E4<=500,54.0...

Conditional count 01-25-10
I need to count unique occurances of names in column a which satisfy conditions in two other columns. For instance: A B C Smith faculty annual fund Smith faculty annual fund Jones faculty annual fund Smith faculty new gift Jones faculty new gift The number of unique occurances of Smith in column A where column B=faculty and column C=annual fund. The answer of course is 2, but how do I write a formula ...

Synchronize Outlook 2003 on two computers?
Any way to do this? Searched KB &TechNet, but only got articles on server sync... Thanks! Jack Jack Black wrote: > Any way to do this? Searched KB &TechNet, but only got articles on > server sync... > > Thanks! > Jack See http://www.slipstick.com/outlook/sync.htm Check this page for all you need to know: http://www.slipstick.com/config/backup.htm -- Aloha, -Ben- Ben M. Schorr, OneNote-MVP http://home.hawaii.rr.com/schorr Microsoft OneNote FAQ: http://home.hawaii.rr.com/schorr/Computers/OneNoteFAQ.htm **I apologize but I am unable to respond to direct r...

run two queries from one click?
This has to be easier than I'm making it. I have a form with these fields: TaskID - number Task Description - text Month Completed - text list pulled from a query Year Completed - text list pulled from a query Category - text list pulled from a query, can be more than one category per task Task Description - memo Now what I want to do is... insert TaskID, Description, Month Completed, Year Completed and Description in one table AND insert TaskID and each Category into another table with a single button click to make it easy for users. As stated above, there can be more than one cate...

How to change line chart color based on condition like + and -.
I have a line chart that is somtimes negative and somtimes positive. I would like the line when negative to be red and when positive to be black or blue or green. Is there a conditional format procedure for line charts? Hi, This may help http://www.andypope.info/charts/conditionalline.htm Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "egii" <egii@discussions.microsoft.com> wrote in message news:405150D2-D170-4CC1-9F38-1A585172B293@microsoft.com... >I have a line chart that is somtimes negative and somtimes positive. I >would > li...

WHAT IS THE FORMULA TO CALCULATE HOURS BETWEEN TWO TIMES
i want to calculate with the help of excel worksheet the hour worked by an employee if his in and out timings are given. for example if ones in time is say 9.30am and his out time is 6.42pm what is the total hours worked by him. to find out this what is the formula used? Just subtract and format as time. If you need hours in order to calculate pay, it's =(B1-A1)*24*C1 where start time is in A1, end time in B1, hourly rate in C1. On Mon, 27 Sep 2004 14:13:05 -0700, "babu" <babu@discussions.microsoft.com> wrote: >i want to calculate with the help of excel workshee...

"Money's balance disagrees with statement balance"
When I go to reconcile my credit union checking statement each of the last several months with my money account, the starting balance is not what I entered the previous month from my paper statement. When I change it to what the paper statement says, I get a warning. I ignore the warning, enter the statement ending balance, and the account always reconciles to 0 discrepancy. But then next month, the previous ending balance gets changed when I go to reconcile the new month and I again have to correct. This started a few months ago. Never had a problem before and I don't think I chan...

If Statement with And and Or
I wrote the following calculation on a form and it does work, however, I know that it can be combined. I have been trying, but no matter how I combine them I keep getting errors. Here is what I have without combining the last two IIfs. =IIf(([txtBannerType]="Standard" And [txtPaperType]="Large Format Bright White (#24)"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Large Format Bright White (#24)"),([lngCount]*[lngFeet])*1,IIf(([txtBannerType]="Standard" And [txtPaperType]="Standard White Continuo...

Need help making chart using data from two columns? Elementary....
Hi, This is prabobally very simple I guess, but I can't figure out how to get it to work.... I was trying to make a chart that would use data from two columns.. more less like that: One column "A" let's say has names of people who bought something JACK, JOHN, JEFF etc... SECOND column "B" has how much they each spent next to their name so whatever $1, $2, $15 etc... Now the names will repeat with some other $.... of who bought something. So this is what I would like the chart to do... Check column "A" find all the JACK's and SUM what he sp...

Conditional formatting
Hi, I need help I want to do the following thing in excel If i have to make condition for the selected cell that if any perticular cell is equal to something the selected cell should have some color, please let me know how i can do this? Thanks Vinit Just copy and paste the below formula in any of the cell ="store.murpheythejeweler.com/store/p/"&7062+ROW(A1)&"-Tungsten-Flat-8mm-Polished-Band.aspx" Now place the cursor on the pasted cell and drag it for the remaining cells. Or Copy that cell and paste it for the remaining cells. If th...

Price Lists
I think I know what the answer is going to be. Our retail arm sells all products at 100% of list price; the item price lists are set up accordingly. However we'd like to have a price level of cost+0%, which we can use to sell items to certain wholesale divisions of our company. It doesn't look like I can assign two price levels having different price methods to the same item. Am I right? Our list price includes GST and markup, so figuring cost backwards from list will always be a two step process (in case anyone was about to suggest that). Am I missing something? You can set...

Help: Joining Two subroutines
Pardon me this is my first week learning VBA . I have two excel sub-routines each working independently , how can i link them so that i can insert them to the same sheet module . Sub A() End If End Sub B() End If End Sub Sub --- Message posted from http://www.ExcelForum.com/ Not sure what you mean byu "Joining", but running C will run A, then B. This is how the code should appear in your module: Sub A() MsgBox "Hi from A" End Sub Sub B() MsgBox "Hi from B" End Sub Sub C() A B MsgBox "Hi from C" End Sub HTH, Bernie MS Excel MVP "kankel...

how do I condense a two page letter to one page
what is the procedure to use when a letter spills over onto a second page and you want make it fit onto one page? Decrease the margins? Make the fonts smaller? Edit out some of the content? Wave a magic wand? "staples" <staples@discussions.microsoft.com> wrote in message news:A5E80642-009D-4AC4-8B5D-3E3CD5EB1BEE@microsoft.com... : what is the procedure to use when a letter spills over onto a second page and : you want make it fit onto one page? To fit more text on the page: * Make your margins smaller so the text area is larger * Use a smaller font * T...

Multiple nested if statements
Hi, I have a list of 10 possible categories of debt, i.e: A 0 - 100 B 101 - 200 C 201 - 300 D 301 - 400 E 401 - 500 etc. I also have a list of debts, by invoice, with varying amounts, i.e: Invoice 1 $159 Invoice 2 $345 Invoice 3 $677 Against the invoice I want to add the category it falls into, i.e A,B,C etc. Because there are 10 categories there are too many to use =if(.... how can I do this? Thank you Amanda With an invoice in C5 try: =CHAR(64+FLOOR(C5,100)/100) -- HTH Sandy In Perth, the ancient capital of Scotland and the crowning place of kings sandymann2@mailinator.com ...

conditional formatting within chart
I've got a bar chart (the lines flow left to right) that i update every week...the current bar chart i'm using has some sort of conditional formatting where if the number is >0, the bars are all green, but if the number is <0, then all the bars are red...for some reason my original chart's formatting stopped working. how do i set that up, short of highlighting each bar...i've got about 20 graphs to update... Thanks!!! JC The way that I would do it is to have two sets of helper columns, one with the negatives and one with the positives, like so =(IF(H1<0,ABS(H...

Two columns one stacked
I am trying to create a chart that has three pieces of data (one objective and two actuals) and have them combined into two columns for specific areas. I'd like the objective to be one color and the actuals to be a stack of the two sets of actuals to show the detail between the two. I have been unsuccessful in creating such a chart. I'm not sure if this is even possible. I'm using Excel 2003. Thank you. See the second example at http://people.stfx.ca/bliengme/ExcelTips/Columns.htm best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "ir...

Synchronize two combo boxes on a form
I'm using Sql 2000 and Access 2003. I'm using the code below that's from Article ID 289670. Me.Department.RowSource = "SELECT Departments FROM" & _ " Department WHERE BranchId = " & Me.Branch & _ " ORDER BY Departments" Me.Department = Me.Department.ItemData(0) I got the code to work but I had to copy and rename my tables to Department and Branch. My original tables were named with tbl. My combo boxes were named with cbo but I had to rename them. I've tried everything to get the code to work with the tbl and c...

overlay two graphs with different x axis
hi there i'm having trouble trying to overlay 2 graphs together, the are shown below. 'cost graph (http://img398.imageshack.us/img398/4893/costgraph7bj.jpg) 'phase graph (http://img382.imageshack.us/img382/976/phasegraph5oo.jpg) the data used is shown here: 'data' (http://img395.imageshack.us/img395/8226/data1vl.jpg) for the cost graph, it is a standard line graph: y axis is I9:I24, axis is K9:K24 for the phase graph, it is a stacked column graph with a hidden dat series: y axis is stacked K3:K6 and L3:L6, and the x axis is G3:G6 is it possible to overlay these gra...

IIF statement to run a Macro?
In a Form, I want to run a Macro if a specific condition is met. Does anyone know how to do this? I tried a Command button but it does not have th Control source line to enter an expression. I tried a bund text box which allows IIF statements but if the condition is met, I do not see how to run my macro. Thanks in advance, Bill Run the macro at all times. Use a Condition in the macro to test whether to stop the macro (first step action in the macro). -- Ken Snell <MS ACCESS MVP> "BillH" <whoward@tufts-nemc.org> wrote in message news:1190822221.588947.58...