Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested If statement in Excel>Word merge for Days (M, MW, MWF) 3

Status
Not open for further replies.

dcompto

Technical User
Jul 5, 2001
751
US
I'm trying to create a Class Schedule by merging data from Excel to Word 2011. The "Days" column is Text and the "Start" and "End" columns are time fields. The Excel data looks like this:

Code:
Course    Description   Days   Start    End     Room    Instructor
MAE 3323  Mech Des I	MWF    8:30	9:20	EN415B	Smith
ENGR1111  Intro to Engr M      3:30     4:20    CLB118  Jones
MAE 4344  Des Projects  MW     1:30     3:20    EN 208  Green

The Word document is a Table of 5 columns:

Code:
|  MON  |  TUE  |  WED  |  THU  |  FRI  |

Courses should be listed in order of Start time within the appropriate Weekday column.

Any clues as to how to do a nested IF statement so all Monday classes will list in the MON column, etc., would be much appreciated.

Thanks!
 
hi,

Your 'shorthand' Days, has bitten your hand. If it were me, I would NORMALIZE your data in Excel, to make it useable AND fix the times...
[tt]
Course Description Days Start End Room Instructor
MAE 3323 Mech Des I Mon 08:30 09:20 EN415B Smith
MAE 3323 Mech Des I Wed 08:30 09:20 EN415B Smith
MAE 3323 Mech Des I Fri 08:30 09:20 EN415B Smith
ENGR1111 Intro to Engr Mon 15:30 16:20 CLB118 Jones
MAE 4344 Des Projects Mon 13:30 15:20 EN 208 Green
MAE 4344 Des Projects Wed 13:30 15:20 EN 208 Green
[/tt]
BTW, what happens on [highlight] T[/highlight], or [highlight]T [/highlight]?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
The easiest, and sloppiest, way to fix this is add 5 more columns, MON TUE WED etc...
[tt]
In the MON Column: =IFERROR(SEARCH("M",C1),0)
In the TUE Column: =IFERROR(SEARCH("T",C1),0)
etc...
[/tt]
 
Thanks for your help, Skip and Gruuuu, I'm going to try the "easiest and sloppiest" way first (with the hope that it will be quicker).

Skip, as to your question, "what happens on T, or T ?", we use R for Thursday.
 
It could be done with IF tests, but it'd be ugly - mainly because you'd have to test for every possible position that the letter for a given day can occur in your 'days' field. For example, assuming the days are always in order, testing for 'W' would require:
{IF{={IF{MERGEFIELD Days}= "W*" 1 0}+{IF{MERGEFIELD Days}= "?W*" 1 0}+{IF{MERGEFIELD Days}= "??W*" 1 0}}= 1 "Wednesday"}

Cheers
Paul Edstein
[MS MVP - Word]
 
Thanks, macropod, Gruuuu, and SkipVought. I've learned something from each of you and I really appreciate your input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top