Nested IF AND formula

Mariyka1

New Member
Joined
Nov 1, 2016
Messages
44
I've tried this in multiple ways but I'm not having much luck. I need to be able to look up two separate columns - one with a date (greater than) and one with text (that contains) - with two different conditions. "Phase 2" would have both of these conditions met, "Phase 1" is anything else.
If anyone can help if at least I'm on the right track per below:


=IF(AND(M4>"08/01/2017",ISNUMBER(SEARCH("A",Q4)),"Phase 2",IF(AND(M4>"12/01/2017",ISNUMBER
(SEARCH("B",Q4))),"Phase 2","Phase 1"))


Any help is appreciated!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
The problem is with how you are comparing dates.
If M4 is really a date entry, your formula is comparing it to the text values of "08/01/2017" and "12/01/2017", not the dates.
You can convert those text entries to dates like this:
Code:
M4>[COLOR=#ff0000]DATEVALUE[/COLOR]("08/01/2017")
 
Last edited:
Upvote 0
Hi ,

You can also try this :

=IF(AND(M4>"08/01/2017"+0,ISNUMBER(SEARCH("A",Q4))),"Phase 2",IF(AND(M4>"12/01/2017"+0,ISNUMBER(SEARCH("B",Q4))),"Phase 2","Phase 1"))

The addition of 0 (the operation of addition) changes the data type of the text string "08-01-2017" to a number , and therefore a valid date.
 
Upvote 0
The problem is with how you are comparing dates.
If M4 is really a date entry, your formula is comparing it to the text values of "08/01/2017" and "12/01/2017", not the dates.
You can convert those text entries to dates like this:
Code:
M4>[COLOR=#ff0000]DATEVALUE[/COLOR]("08/01/2017")



Thank you very much both of your solutions worked!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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