Complex combination of IF/AND Formula (Help Needed)

dmxcasper2

Board Regular
Joined
Mar 21, 2012
Messages
65
Problem Statement:
I am having difficulty creating a formula that will take multiple AND and IF criteria into calculation based on today's date. Please see below for (4) logic statements that I have been trying to incorporate into a single formula string.

Column E is the output. (Where the formula would reside)


Capture.jpg



Formula is needed based on the following logic statements:
  1. If there is no date in Column A, then default to "blank" in Column E
  2. If there is a non-date attribute (example: "TBD", or "TBA") in Column A, then default to "blank" in column E
  3. If there is a date in Column B, then subtract it from MAX of Column C and D.
  4. If there is a date in Column A and Column B is blank, take the MAX date of Column C and D and subtract it from today's date

Any help is appreciate it.
I can't find a good source online to explain/teach the logic behind creating these AND and IF combinations.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
How about
=IF(OR(A2="",ISTEXT(A2)),"blank",IF(B2<>"",MAX(C2:D2)-B2,TODAY()-MAX(C2:D2)))
 
Upvote 0
Hi,

Another way to write that formula:


Book1
ABCDE
2 
3TBD
49/29/201810/3/201810/2/201810/4/20181
59/29/201810/2/201810/30/201845
Sheet398
Cell Formulas
RangeFormula
E2=IF(N(A2)=0,"",IF(B2,MAX(C2,D2)-B2,TODAY()-MAX(C2,D2)))


Formula in E2 copied down.
 
Upvote 0
Thanx Fluff and jtakw. Both formulas work as intended.

Is is possible to also integrate the following logic statements to both of your existing formulas?

If Column A has a date and Column B is blank, and also if Column C or D is blank then equal "blank"
If Column A & Column B has a date, and also if Column C or D is blank then equal "blank"
 
Upvote 0
See if this does what you describe:


Book1
ABCDE
2 
3TBD
49/28/201810/2/2018
59/29/201810/3/201810/2/201810/4/20181
69/28/201810/3/2018
79/29/201810/2/201810/30/201845
Sheet398
Cell Formulas
RangeFormula
E2=IF(OR(N(A2)=0,C2="",D2=""),"",IF(B2,MAX(C2,D2)-B2,TODAY()-MAX(C2,D2)))
 
Upvote 0
See if this does what you describe:

ABCDE
2
3TBD
49/28/201810/2/2018
59/29/201810/3/201810/2/201810/4/20181
69/28/201810/3/2018
79/29/201810/2/201810/30/201845

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet398

Worksheet Formulas
CellFormula
E2=IF(OR(N(A2)=0,C2="",D2=""),"",IF(B2,MAX(C2,D2)-B2,TODAY()-MAX(C2,D2)))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



jtakw,

I used the above formula and dissecting the data, I found couple of calculation issues based on the below logic satements


  1. If there is no date in Column A, then default to "blank" in Column E
  2. If there is a non-date attribute (example: "TBD", or "TBA") in Column A, then default to "blank" in column E
  3. If there is a date in Column B, then subtract it from MAX of Column C and D.
  4. If there is a date in Column A and Column B is blank, take the MAX date of Column C and D and subtract it from today's date
  5. If Column A has a date and Column B is blank, and also if Column C or D is blank then equal "blank"
  6. If Column A & Column B has a date, and also if Column C or D is blank then equal "blank"


Capture2.jpg
 
Upvote 0
Thanx Fluff and jtakw. Both formulas work as intended.

Is is possible to also integrate the following logic statements to both of your existing formulas?

If Column A has a date and Column B is blank, and also if Column C or D is blank then equal "blank"
If Column A & Column B has a date, and also if Column C or D is blank then equal "blank"

In Both your Post # 4 and Post # 6 above, your written description says Either C OR D is blank, then return Blank, but your sample in Post # 6 shows when Both are blank, then return Blank.

Try this version:


Book1
ABCDE
710/2/201810/10/201810/8/20182
810/2/201810/16/201810/8/20188
910/4/201810/17/201810/8/20189
1010/16/201810/25/201810/19/201810/26/2018-1
1110/21/201811/1/201810/26/201810/30/20182
1211/1/201811/2/201811/15/2018-13
Sheet398
Cell Formulas
RangeFormula
E7=IF(OR(N(A7)=0,AND(C7="",D7="")),"",IF(B7,B7-MAX(C7,D7),MAX(C7,D7)-TODAY()))


BTW: it would be helpful if you can upload a table rather than a picture, so that helpers can copy and paste your data for testing.
 
Upvote 0

Forum statistics

Threads
1,214,962
Messages
6,122,482
Members
449,088
Latest member
Melvetica

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