# Excel formula question

Hello,

Let's say you are using an Excel spreadsheet for the purpose of making assignments in a group of people for the next 12 months to do some task once each month.

In the spreadsheet, suppose column C contains sequential dates of the month and column B contains a number indicating how many times that particular day has occurred that month (Fig. 1).
(Note that rows 13 thru 33 have been hidden in Fig. 1)

For example:

• Cell B5 = 1, indicating that October 3rd is the 1st Monday of the month,
• Cell B10 = 2, indicating that October 8th is the 2nd Saturday of the month,
• Cell B12 = 2, indicating that October 10th is the 2nd Monday of the month,
• and so on.

Also, suppose that the same spreadsheet contains a table of names (Fig. 2), in which columns G:M are headed by the seven days of the week and column F contains 1st thru 5th (corresponding to the numbering in column B) to designate to which occurrence of a particular day each person is assigned.

What formula would accurately populate column D (Figs. 3 & 4) with the correct names from the table?

(Note:  All Figs. show the same spreadsheet.  Figs. 2 & 3 show the assignment columns and the table separately [so they are easier to see] whereas Fig. 4 shows both of them together.)
(Note that rows 13 thru 33 have been hidden in Fig. 3)

For example, the table indicates that:

• Gary has the 1st Friday of each month so his name should be displayed for Oct 7, Nov 4, etc.
• Paul has the 1st Saturday of each month so his name should be displayed for Oct 1, Nov 5, etc.
• Dave has the 2nd Saturday of each month so his name should be displayed for Oct 8, Nov 12, etc.
• and so on
(Note that rows 13 thru 33 have been hidden in Fig. 4)

Thanks
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EngineerCommented:
Can you upload a part of your spreadsheet. It is important to know how you have entered the dates.
0
EngineerCommented:
Try one of these formulas

=INDEX(\$G\$2:\$M\$6,\$B3,MATCH(TEXT(C4,"ddd"),LEFT(\$G\$1:\$M\$1,3),0))
=INDEX(\$G\$2:\$M\$6,\$B3,MATCH(LEFT(\$C3,3),LEFT(\$G\$1:\$M\$1,3),0))
0
Commented:
Steve,

Please see attached. There are two sheets - "String" assumes that the date is simply a string as shown, whereas "Date" assumes it's a formatted date, take your pick!

I've cheated and abbreviated the names of the days in the table. Obviously that can be easily changed if necessary.

My formulas are highlighted in yellow -
"String"
=IF(B3="","",OFFSET(\$F\$1,A3,MATCH(TRIM(MID(B3,1,FIND(",",B3,1)-1)),\$G\$1:\$M\$1,0)))
"Date"
=IF(B3="","",OFFSET(\$F\$1,A3,MATCH(TEXT(B3,"ddd"),\$G\$1:\$M\$1,0)))

Regards,
Brian.
Assignments.xls
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

EngineerCommented:
I forgot to mention that the formulas I have provided are array formulas and should be entered by pressing ctrl-shift-enter.
0
Author Commented:
Thanks for the response.

>>It is important to know how you have entered the dates.

Formatting for the date column is:  ddd, mmm dd.  The dates were created simply by entering "10/1/2011" in cell C3, then "=C3+1" in cell C4 and pasting it down.   Everything else was entered manually.
0
EngineerCommented:
Then you can try my first formula
0
Commented:
Or my "Date" sheet. :)
0
Author Commented:
>>ssaqibh:
Try one of these formulas

Try them by pasting in which cell?

Neither formula appears to work:

1st formula puts Paul in cell D10.  2nd Saturday is Dave.
2nd formula results in #N/A
0
Commented:
Steve,

I compared my results to yours and they agreed. Please look at the file!

Thanks,
Brian.
0
Author Commented:
>>redmondb:

That's it Brian!  I had the first part using =OFFSET() but I needed help with setting up the =MATCH().

Thanks a bunch!  :)
0
Commented:
0
Author Commented:
And you even included:

=IF(B3="",""

That was going above and beyond!  LOL
0
Commented:
BTW, simple change to the formula if you want the full day names in the table...

=IF(B3="","",OFFSET(\$F\$1,A3,MATCH(TEXT(B3,"dddd"),\$G\$1:\$M\$1,0)))
0
Commented:
Well, you are paying for the Premium service!
0
Author Commented:
>>>BTW, simple change...

Yep, just spotted that too.

BTW, your response and the one from ssaqibh just brought up a question I'm always wondering regarding when to use  =Match() vs. =Index().  However, I will close this out and post that in a separate thread.

Thanks again.
0
Author Commented:
Thanks
0
Commented:
Thanks, Steve.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.