# Need help to write formula in Excel

Hi,
We have two colun in my excel. 1. Amt1 , Amt2 and i need to come up with "Output calculate column with following criteria.

if “Amt1” is 1.50 or less and “Amt2” is 2:00 or less, “Output” is “Yes.”
If “Amt1” is 1.50 or less and “Amt2” is greater than 2:00, “Output” is “No.”
If “Amt1” is greater than 1.50 and “Amt2” is 4:00 or less, “Output” is “Yes.”
If “Amt1” is greater than 1.50 and “Amt2” is greater than 4:00, “Output” is “No.”

###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ConsultantCommented:
Hi,

If Amt1 is in Column A, and Amt2 is in column B, then you could try something like this:

=IF(AND(A1<=1.5,B1<=2),"Yes",IF(AND(A1<=1.5,B1>2),"No",IF(AND(A1>1.5,B1<=4),"Yes",No")))

Adjust the column letters and row numbers to suit your actual data.

Alan.
I would use Alan's formula and revised to this instead:

``````=IF(AND(A2<=1.5,B2<=TIME(2,0,0)),"Yes",IF(AND(A2<=1.5,B2>TIME(2,0,0)),"No",IF(AND(A2>1.5,B2<=TIME(4,0,0)),"Yes","No")))
``````
Excel & VBA ExpertCommented:
Amt2 column contains number or a time value?

If Amt2 is number...
``````=IF(OR(A2="",B2=""),"",IF(A1<=1.5,IF(B2<=2,"Yes","No"),IF(B2<=4,"Yes","No")))
``````

If Amt2 is time...
``````=IF(OR(A2="",B2=""),"",IF(A2<=1.5,IF(B2<=TIME(2,0,0),"Yes","No"),IF(B2<=TIME(4,0,0),"Yes","No")))
``````
Finance AnalystCommented:
Your Amt1 doesn't seem to have any impact on the result, only the Amt2 changes the result.

02:00      04:00
1.5      Yes            No
10      Yes            No

So you only need to test the value of Amt2:

=IF(B2<=TIME(2,0,0),"Yes","No")
Author Commented:
Thank you all for quick support. I apologies for requirement change. The amt2 is the calculate  hour column from Start Date and End Date. Can you please help me to write one formula to accomplish this?

Thank you.
Calculate-Column.xlsx
Excel & VBA ExpertCommented:
Try this...

In F2
``````=IF(OR(C2="",D2="",E2=""),"",IF(C2<=1.5,IF(E2-D2<=TIME(2,0,0),"Yes","No"),IF(E2-D2<=TIME(4,0,0),"Yes","No")))
``````

OR using table structured reference...
In F2
``````=IF(OR([@Amt1]="",[@[Date/_Start]]="",[@[Date_End]]=""),"",IF([@Amt1]<=1.5,IF([@[Date_End]]-[@[Date/_Start]]<=TIME(2,0,0),"Yes","No"),IF([@[Date_End]]-[@[Date/_Start]]<=TIME(4,0,0),"Yes","No")))
``````

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Thank you Neeraj and Thank you all for your help.
Excel & VBA ExpertCommented:
You're welcome!
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.