formula that returns column headings based on multiple criteria

Jamel

Board Regular
Joined
Mar 2, 2010
Messages
55
Below I'm showing a sample of the spreadsheet I'm working with. I'm looking for a formula that
answers the Answer 2 column. I've already successfully created a formula that answers Answer 1.
In the Answer 1 column I capturing the column heading where the first "A" absence appears.
The true column heading I've highlighted in blue. I included a heading over that row just in case
I need to reference that to compare to the days the student attends class.

Answer 2 is a lot more trickier because I have to honor the days of the week each student attends the class.
In Answer 2 I need to capture the column where the first blank appears after the first "A" absence
while honoring the days of the week the student attends the class. In my table below I've answered
all the Answer 2 to show what needs to be the result.

As always any help with this will be greatly appreciated

not sure why all the grid lines are showing.. there are showing before I hit the post button.



ABCDEFGHIJKLMNOPQRSTUV
1WHFMTWHFMTWHFMTWHF
2days of week3458910111215161718192223242526Answer 1Answer 2
3Student 1M WAAAAAA322
4Student 2T HAAAAA923
5Student 3HAA418
6Student 4M T W H FA1011
7Student 5WAAA324
8Student 6HAAA411
9Student 7M W FAAAAAA517
10Student 8TAA916
11Student 9MA815

<tbody>
</tbody>
Sheet1
 
Last edited:
Don't know how to delete this post that had a bad format. Please look at the post below that contains my current problem.
 
Last edited:
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I’m still having issues with this spreadsheet. The formulas I was provide only seems to work when the absent and return date are within the same month. Below is a table showing the answers I’m looking.


Book1
ABCDEFGHIJKLMNOPQRSTUVWX
1monthAPRILAPRILAPRILAPRILAPRILAPRILAPRILAPRILAPRILMAYMAYMAYMAYMAYMAYMAYMAYMAYABS MONTHABS DAYRETN MONTHRETN DAY
21day of weekRFMTWRFMTWRFMTWRFMANSWERANSWERANSWERANSWER
32days of week18192223242526293012367891013
43M WAAAAPRIL24APRIL29
54T RAAAAAPRIL23MAY2
65RAAAPRIL25MAY9
76M T W R FAAAAAAAAPRIL25MAY2
87WAAAPRIL24MAY8
98RAAAAPRIL18MAY9
109M W FAAAAAAAAAPRIL22MAY10
1110TAAPRIL30MAY7
Sheet1
 
Upvote 0
Try

I used a helper column to make things easier


U
V
W
X
Y
1
ABS MONTH​
ABS DAY​
RETN MONTH​
RETN DAY​
Helper​
2
ANSWER​
ANSWER​
ANSWER​
ANSWER​
3
4
APRIL​
24​
APRIL​
29​
7​
5
APRIL​
23​
MAY​
2​
6​
6
APRIL​
25​
MAY​
9​
8​
7
APRIL​
25​
MAY​
2​
8​
8
APRIL​
24​
MAY​
8​
7​
9
APRIL​
18​
MAY​
9​
3​
10
APRIL​
22​
MAY​
10​
5​
11
APRIL​
30​
MAY​
7​
11​

<tbody>
</tbody>


Formula in Y4 copied down (Helper column)
=AGGREGATE(14,6,(COLUMN(C3:T3)/((C$1:T$1=U4)*(C$3:T$3=V4))),1)

Formula in W4 copied down
=INDEX(C$1:T$1,MATCH(1,INDEX((ISNUMBER(MATCH("*"&C$2:T$2&"*",B4,0)))*(COLUMN(C$3:T$3)>Y4)*(C4:T4=""),),0))

Formula in X4 copied down
=INDEX(C$3:T$3,MATCH(1,INDEX((ISNUMBER(MATCH("*"&C$2:T$2&"*",B4,0)))*(COLUMN(C$3:T$3)>Y4)*(C4:T4=""),),0))

Hope this helps

M.
 
Last edited:
Upvote 0
First of all Thanks for the quick response. The sample spreadsheet shown above I had to manufacture on the side so I could show what I needed.

On my real spreadsheet I have additional codes other than just "A". However I want the formulas based only wanting to capture the "A's".

Will it matter that I have additional codes in the spreadsheet?
 
Upvote 0
I'm running into a few annomalies were it's not returning the month. Also the Helper field is returning values over 31.

having difficulty figure out if anything different in the data is causing this
 
Upvote 0
I'm not sure if the formula works if the occurrence span beyond 2 month. For example if I'm absent Feb 22 and dont return until April 3.
 
Upvote 0
Hello,

Sorry to keep bugging you Marcelo Branco
user-offline.png
but I'm running into a few anomalies where that formula you gave me isn't working.

for example... I have a student schedule to attend a class monday and thursdays. The student was abscent on the 14th, 18th, 21st, 25th, and the 28th of February.

The student returned on March 4. The return month formula is working correctly by assigning Mar. however the return day is showing the 18 and the helper is showing 25.

The majority of the records the formula is working correctly.

Seems like I'm still having issues when the student return in a different month. Any help will be greatly appreciated.

The formula seems very close to being perfect.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

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