Photos Not Found

A student in today's class asked me about photos and the MATCH function. The question was, if we have a list of students, some of whom have had their photo taken, and some who have not, how can we get the ones with pictures to show the message "No Photo," and the students with a photo, show the photo instead of the row number.

The formula is:
=IF(ISNA(MATCH(A2,Photos!$A$1:$A$427,FALSE)),"No Photo",VLOOKUP(A2,Photos!$A$1:$D$427,3,FALSE)

The components:

The IF function: if condition, then message, otherwise alternate message

The ISNA function is a test - if I do a lookup for a value, will I get the #N/A error? If so, then ISNA is true.

In other words, if I do a match for the student's student number in the Photos worksheet, and I get #N/A, I want the "No Photo" message to show up.

If I can find the student, then I want to return the photo number.

Truly Unique User Names

One of the questions I got in Open Session related to how to create truly unique usernames. My customer had the first name in column A, the last name in column B, and the middle initial in column C.

I could do my 4-1-1 trick, which would be =LEFT(B2,4)&LEFT(A2,1)&C2, but that's no guarantee of complete uniqueness.

What is? In the adjacent column to the username (let's say it's column D), add a little COUNTIF magic; assume that the last username is in row 224:


(Assume that one of the usernames is my old Pearson username - lillgg, or Geoffrey G Lilley. Imagine further that Grace G Lilley also works for my school.)

Notice the dollar sign is ONLY after 224, the last row. The net result is that the first time I find the username "lillgg", I see the number 1. If I find it a second time, I see a "2" in that cell.

Almost there.

The customer I was working with wanted the second username (the second lillgg) to be "lillgg02" but the first one to be just "lillgg." So we want an IF function, I think.

The D column had the username, so the COUNTIF function is in column E. In column F, use the IF function:

In other words, if it's the second time this username shows up, add a zero and the number (2,3) to the end; otherwise, just leave it be.

Example below:

User Name

Abbot, Julie D
Abbott, James D
Abram, Michael W
Accatino, Steve P
Adair, Amanda L
Adams, Mark K
Allen, Sarah D
Arnold, Jim S
Arnold, Paul B

Splitting Dates

Several of you who were transitioning over from SASI had a similar question - how to take a date that was formatted yyyy-mm-dd (2010-06-21) and turn it into a date that was readable by Excel?

There's two ways to do it.

The first way I could think of is three text functions; assume the dates are in column A:

In other words, take out the month first. The month is in the middle, so we use the MID function. Start at the fifth character, and get two characters, the fifth and the sixth. Add a slash (or dash). Get the day by using the RIGHT function, and get the two rightmost characters. Add another slash. Get the year by taking the first four characters.

Alternatively, you could use Text to Columns. Instead of Delimited, though, you might end up having to use Fixed Width, if there's no dash or slash to break up the pieces. Just use Fixed Width, and then break the date up at the year and month, respectively:
Then, click Finish, and your date will be broken up.

To put it back together: