• 100% Satisfaction Guarantee
Jess M., Computer Support Specialist
Category: Microsoft Office
Satisfied Customers: 6868
Experience:  Computer Software Specialist for more than 10 years
49766785
Type Your Microsoft Office Question Here...
Jess M. is online now

# im trying to use a if statement but dont now how to make it

im trying to use a if statement but don't now how to make it do what I want

if A2 is between 5000 & 5999
true h2+250-d2
False ""

=IF(A2 ?????",H2+250-D2,"")
Hi, welcome and thank you for your question. My name is XXXXX XXXXX I am glad to assist you today.

You can use the AND function to encapsulate your IF conditions. Here is a working logic:

IF A2 > 5000 and
IF A2 < 5999 and

This means that if A2 is greater than or equal to 5000 but less than and equal to 5999, H2 + 250 - d2. Else, it shows blank.

Now, the formula shall be:
=IF(AND(A2>5000,A2<5999),H2+250-C2,"")

Please remember to rate my service positively (3-5 stars/faces) once you have all the
information you need. Tips are always highly appreciated!

If you have any other questions, please ask me or reply to me – I’ll be happy to respond.

Thank you!

Best regards,
Jess
Customer: replied 4 years ago.

this is weird when I do it alone it works but when I put it in the form

it dont work it just gives me a false reading ""

A2 = 5140

H2 = 500

C2 = 700

the outcome should be 50

I get ""

Ken,

What form are you referring to? Here is the Excel file that serves as sample for you.

If it has combo boxes or other controls, please make sure that the references of cells are intact. Also, you can send a copy of the Excel file by uploading it to http://wikisend.com and then give me the 6-digit File ID so that I can download your sample Excel file.

I hope that helped.
Jess
Customer: replied 4 years ago.
I got the file. Give me a minute to check it.

Jess
Ken,

Thank you for waiting. Instead of using AND, we need to use OR. AND logic means that ALL conditions must be TRUE so that it will result to true. Otherwise, it will result to false.

The OR logic however gives TRUE if ANY one of the logic is TRUE. In the new OR formula, if A3 > 5000 OR A3 < 5999, it will result to true and will calculate the TRUE statement.

Also, I created a second sheet with the inclusive formula. That is, if A3 = 5000 and A3 = 5999, it will give TRUE.

Please remember to rate my service positively (3-5 stars/faces) once you have all the
information you need. Tips are always highly appreciated!

If you have any other questions, please ask me or reply to me – I’ll be happy to respond.

Thank you!

Best regards,
Jess
Customer: replied 4 years ago.

the file you sent back says

=IFERROR(IF(OR(A3>5000,A3<5999),(E3+500)-C3,""),"")

whats = iferror

also if I change the truck # XXXXX formula don't change anything?

Ken,

Sorry for the confusion, but the logic should be AND because it is inclusive. That is, A3 MUST BE greater that 5000 but less than 5999. If it is an OR, if the truck number is XXXXX it must be false, but the OR formula gives a TRUE because A3
Here is the formula:
=IFERROR(IF(AND(A3>5000,A3<5999),(E3+500)-C3,""),"")

IFERROR means, if the result is an error, it will show "" (blank). If there is no error, it will show the results of the formula.

Here is the formula with NO iferror encapsulation:
=IF(AND(A3>5000,A3<5999),(E3+500)-C3,"")

The problem WHY the results are not displayed is because the numbers in the truck # XXXXX is set to TEXT, not numbers. I changed them to number format so it works now.