# IF Function

#### BeckaB

##### New Member
I have a if formula based on 2 cells:

So..

IF
D15 = YES and D17 = BLANK Then return "C2"
IF D4 = YES and D18 = BLANK then return "C2"
If Both D15 and D4 = YES and both D17 and D17 = blank then return "C2"

#### BeckaB

##### New Member
Sorry should have added, if the cells are not blank then it needs to do a sum of cells D21 & D22

#### KOKOSEK

##### Board Regular
I have a if formula based on 2 cells:

So..

IF
D15 = YES and D17 = BLANK Then return "C2"
IF D4 = YES and D18 = BLANK then return "C2"
If Both D15 and D4 = YES and both D17 and D17 = blank then return "C2"
result is always C2? does not make sense.

#### BeckaB

##### New Member
result is always C2? does not make sense.
The result is different depending on the cell.

So if D17 is blank = "Enter Cost1"
If D18 is blank = "Enter cost2"

If both are blank "Enter Cost 1 and Cost2"

#### KOKOSEK

##### Board Regular
What if D15 = YES and D18 = BLANK? or D4=YES and D17=BLANK?

#### KlaasE

##### New Member
What is the question? You just need the syntax for it?

#### BeckaB

##### New Member
IF D15 = Yes and D17 = Blank then "Enter Cost 1"
IF D15 = No and D17 = Blank then sum of D21 & D22
IF D4 = Yes and D18 = Blank then "Enter Cost 2"
IF D4 = No and D18 = Blank then sum of D21 & D22

If both D15 and D4 = Yes and both D17 and D18 are blank then "Enter cost 1 & 2"

#### BeckaB

##### New Member
I have this for the first part which works I just need to add in the second part

=IFERROR(IF(AND(D15="Yes",D17=""),"Cost1",IF(SUM(D6-D22)<=0,"£0.00",SUM(D6-D22))),"")

#### KlaasE

##### New Member
Are these the outcomes you want?

 D15 D17 Yes Blank = "Enter cost 1" Yes Not blank = Sum D21&D22 No Blank = Sum D21&D22 No Not Blank = Sum D21&D22 D4 D18 Yes Blank = "Enter cost 2" Yes Not blank = Sum D21&D22 No Blank = Sum D21&D22 No Not Blank = Sum D21&D22 D15 D4 D17 D18 Yes Yes Blank Blank = "Enter cost 1 & 2"

1,081,749
Messages
5,361,064
Members
400,611
Latest member
ThebigG

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...