IF AND function help: Differentiate with Similar Criteria

KuraiChikara

Board Regular
Joined
Nov 16, 2016
Messages
111
Office Version
  1. 2013
Platform
  1. Windows
Hello,
I have an issue with an IF AND function that contains similar criteria.
Example: Agents have their days off and their week is formatted. IE: Tuesday/Wednesday off will look like this FYSM--R.

Some agents have 3 days off, Tuesday/Wednesday/Thursday off will look like this FYSM---

I have an IF AND formula to format this, but it's that 3rd day off that's causing issues.

Because the agent with the 3rd day off ALSO has Tu/We off, when I put in my formula, FYSM--R is put instead of FYSM---.

I don't know how to get Excel to differentiate "Oh he has Tuesday, Wednesday AND Thursdays off, put FYSM---" Instead, it sees the first matching criteria and puts FYSM--R instead.

Grid explanation:
Everything RIGHT of WEEK FORMULA (Column E) is the reference data for my formula

=IF(AND(B2=$J$1,C2=$K$1),$F$2,IF(AND(B3=$J$1,C3=$K$1,D3=$L$1),$F$3,"NO MATCH"))

The result I want:
John should have FYSM--R
Bill should have FYSM---

[TABLE="class: grid, width: 600, align: center"]
<tbody>[TR]
[TD]Agent[/TD]
[TD]Off1[/TD]
[TD]Off2[/TD]
[TD]Off3[/TD]
[TD]Week Formula[/TD]
[TD]Weeks[/TD]
[TD]Sa[/TD]
[TD]Su[/TD]
[TD]Mo[/TD]
[TD]Tu[/TD]
[TD]We[/TD]
[TD]Th[/TD]
[TD]Fr[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Tu[/TD]
[TD]We[/TD]
[TD][/TD]
[TD]FYSM--R[/TD]
[TD]FYSM--R[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bill[/TD]
[TD]Tu[/TD]
[TD]We[/TD]
[TD]Th[/TD]
[TD]FYSM--R[/TD]
[TD]FYSM---[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi,

Just reverse the order of the IF tests:


Book1
ABCDEFGHIJKLM
1AgentOff1Off2Off3Week FormulaWeeksSaSuMoTuWeThFr
2JohnTuWeFYSM--RFYSM--R
3BillTuWeThFYSM---FYSM---
Sheet215
Cell Formulas
RangeFormula
E2=IF(AND(B2=$J$1,C2=$K$1,D2=$L$1),$F$3,IF(AND(B2=$J$1,C2=$K$1),$F$2,"NO MATCH"))
 
Upvote 0
Hi,

Just reverse the order of the IF tests:

ABCDEFGHIJKLM
AgentOff1Off2Off3Week FormulaWeeksSaSuMoTuWeThFr
JohnTuWeFYSM--RFYSM--R
BillTuWeThFYSM---FYSM---

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet215

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]E2[/TH]
[TD="align: left"]=IF(AND(B2=$J$1,C2=$K$1,D2=$L$1),$F$3,IF(AND(B2=$J$1,C2=$K$1),$F$2,"NO MATCH"))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


How do you copy and paste pictures of your excel spreadsheet like you have jtakw?
 
Upvote 0
I actually have the same question as a the user before me, how do you insert excel images? My examples would be much better if I could do that. The only way I've been able to think of how to do it on this site is to use a photo sharing site to upload images and use the insert image page here. Is that how you do it?
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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