Add a condition to an If Statement

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
850
Office Version
  1. 365
Platform
  1. Windows
Hi,

I've been using this formula for a while and it works good. I added a column (C) and need to modify the formula
Excel Formula:
=IF(AND(F161="charge"),+B161,IF(AND(F161="payment"),-B161,IF(AND(F161="credit"),-B161,IF(AND(F161="pending"),+B161,""))))
It only returns a value if one of the words is in F161, otherwise it keeps the cell blank.

I want to add that if C161 is Blank, then look at the other conditions. If C161 is NOT blank, then disregard the If statement and return a blank cell no matter want the rest of the formula says.

I tried to add the following but it makes the formula wrong
Excel Formula:
=If(And(C161<>””),””,IF(and(…………
F will either be blank or have one of the words in it.

B will either be blank or have a number in it

If C is not blank, it will have a letter in it

All data is entered using the advance filter from another sheet in the same workbook

I’m putting this in T161 and coping it down to T450

Also, should I be using OR instead of And

Mike
 
not sure what the AND is doing as only 1 condition here

=IF(AND(F161="charge"),+B161,IF(AND(F161="payment"),-B161,IF(AND(F161="credit"),-B161,IF(AND(F161="pending"),+B161,""))))

that can be changed to use an OR()

=IF(OR(F161="charge",F161="pending"),+B161,IF(OR(F161="payment",F161="credit"),-B161,""))

so now we can look at adding the criteria
BUT

check that works correctly for you

but this should work

IIF(C161<>"", "", IF(OR(F161="charge",F161="pending"),+B161,IF(OR(F161="payment",F161="credit"),-B161,"")))
 
Upvote 0
Solution
Hi etaf
yep..Works great
I got my formula by coping it from another sheet and modifying it to match the cell numbers. I had to change some of the conditions as well.

It was working so I left it alone. I decided to redo this sheet and had to modify it again.
that's when i ran into trouble.
Than you

mike
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top