# Help with IF AND EXCEL Formula

#### pattih

##### New Member
My formula IF(AND((K4,"Non-Discretionary,M2<44926,"Priority 1",IF(AND((K4,"Discretionary,L4,Discretionary","Priority 3","Not Prioritized")

is returning #VALUE

What I want the formula to do: if k4 = non-discretionary and M2 is less than 12/31/2022, put Priority 1, if K4=discretionary and L4 = discretionary, put Priority 3, and if none of those are true, put "Not Prioritized

for the date column (M), it is formatted as a date, so I wasn't sure i i put in the actual date or the value in the formula.

### Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
G'day Pattih,
You have a number of issues to do with the parentheses, quotation marks and seperators (commas)

For example, K4,"Non-Discretionary,M2
should be K4="Non-Discretionary",M2

You also open 6 parentheses, and only close 1 - you actually only need to open 2 and close 2 for your formula to work correctly

I have tested the following and it works
=IF(AND(K4="Non-Discretionary",M2<44926),"Priority 1",IF(AND(K4="Discretionary",L4="Discretionary"),"Priority 3","Not Prioritized"))

Clearly I am not good at either counting or seeing parentheses - open and close four sets of parentheses.

G'day Pattih,
You have a number of issues to do with the parentheses, quotation marks and seperators (commas)

For example, K4,"Non-Discretionary,M2
should be K4="Non-Discretionary",M2

You also open 6 parentheses, and only close 1 - you actually only need to open 2 and close 2 for your formula to work correctly

I have tested the following and it works
=IF(AND(K4="Non-Discretionary",M2<44926),"Priority 1",IF(AND(K4="Discretionary",L4="Discretionary"),"Priority 3","Not Prioritized"))

Thank you so much for you help! I have copied the formula to my spreadsheet and it worked like a charm! Perfect!

Replies
1
Views
285
Replies
5
Views
2K
Replies
1
Views
275
Replies
4
Views
470
Replies
0
Views
556

1,196,055
Messages
6,013,129
Members
441,750
Latest member

### 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?

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