need help with If ,Index and Match

shahdelsol

Active Member
Joined
Jul 21, 2009
Messages
276
Office Version
  1. 365
Platform
  1. Windows
I am not sure what I am trying to do will be resolved by IF and Index and Match. Here is the scenario. I am matching value in B7 with N7:N13, Once found then looking for matching the value of C5 in O7:013, if match found, 1 , if False 2
One caveat is the value in C5 is the name of weekdays like Monday, Tuesday etc. the cells in O7:O13 could have two weekdays in one cell like Monday, Tuesday. So if C5 says Monday but O7 says Monday, Tuesday for me it is a match. I hope someone can help. Thanks


=IF(INDEX(N6:O13,MATCH(B7,N6:N13,0),MATCH(C5,O6:O13)),1,2)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try:
Book1
ABCDEMNO
4
5Saturday
6
7test31test1Monday, Tuesday
8test2Wednesday, Thursday
9test3Friday, Saturday
10test4Sunday
11test5Tuesday, Thursday
12test6Friday, Saturday
13test7Sunday, Monday
Sheet3
Cell Formulas
RangeFormula
D7D7=IF(ISNUMBER(SEARCH(C5,INDEX(O7:O13,MATCH(B7,N7:N13,0)))),1,2)
 
Upvote 0
This kinda work however didn't work with my C5 formula. I already have this formula "={INDEX(calendar,,daypattern)}" in C5 and somehow your formula doesn't return proper result even my formula shows the exact weekday. If I remove formula from C5 and type in weekdays manually then it works. What do you suggest?


Try:
Book1
ABCDEMNO
4
5Saturday
6
7test31test1Monday, Tuesday
8test2Wednesday, Thursday
9test3Friday, Saturday
10test4Sunday
11test5Tuesday, Thursday
12test6Friday, Saturday
13test7Sunday, Monday
Sheet3
Cell Formulas
RangeFormula
D7D7=IF(ISNUMBER(SEARCH(C5,INDEX(O7:O13,MATCH(B7,N7:N13,0)))),1,2)
 
Upvote 0
Does it give the wrong answer or an error msg?
 
Upvote 0
It gives me wrong answer because I think it doesn't see match rather it sees my formula which is obviously not a match basically the answer is always 2

Does it give the wrong answer or an error msg?
 
Upvote 0
Could it be that the answer from your formula returns in spaces around the weekday?
If so try:
Book1
ABCDEMNO
5Saturday
6
7test31test1Monday, Tuesday
8test2Wednesday, Thursday
9test3Friday, Saturday
10test4Sunday
11test5Tuesday, Thursday
12test6Friday, Saturday
13test7Sunday, Monday
Sheet3
Cell Formulas
RangeFormula
D7D7=IF(ISNUMBER(SEARCH(TRIM(C5),INDEX(O7:O13,MATCH(B7,N7:N13,0)))),1,2)
 
Upvote 0
It didn't work and I don't think if there is any spaces or character or anything. It just seems it reads the actual formula in the cell nor the result.

Could it be that the answer from your formula returns in spaces around the weekday?
If so try:
Book1
ABCDEMNO
5Saturday
6
7test31test1Monday, Tuesday
8test2Wednesday, Thursday
9test3Friday, Saturday
10test4Sunday
11test5Tuesday, Thursday
12test6Friday, Saturday
13test7Sunday, Monday
Sheet3
Cell Formulas
RangeFormula
D7D7=IF(ISNUMBER(SEARCH(TRIM(C5),INDEX(O7:O13,MATCH(B7,N7:N13,0)))),1,2)
 
Upvote 0
Try changing your formula in C5 to
=TEXT(INDEX(calendar,,daypattern),"dddd")
 
Upvote 0
Thank you so much. It did work. I am reviewing the entire file and hopefully this change wouldn't affect other aspects. So far everything looks good.

Try changing your formula in C5 to
=TEXT(INDEX(calendar,,daypattern),"dddd")
 
Upvote 0
Good to hear that seems to be working. If you don't want to change the formula in C5, you could try changing the formula I gave you above to:
IF(ISNUMBER(SEARCH(TEXT(C5,"dddd"),INDEX(O7:O13,MATCH(B7,N7:N13,0)))),1,2)
 
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,462
Members
449,085
Latest member
ExcelError

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