Thread: Last Occurance
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Last Occurance

I gave you a "general" solution (looking for *any* text in the row), but you
said you were marking the attendance with an "X"... so here is a simpler
formula that keys off of that fact (for Row 2 in this example formula)...

=INDEX(B$1:J$1,1,MATCH("X",B2:J2,0))

Again, change the ranges to suit your set up and copy down.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
You posted in a programming newsgroup, so here is a VB answer...

LastUsedColumnInRow2 = Worksheets("Sheet1").Cells(2,
Columns.Count).End(xlToLeft).Column

To do other rows, just change the 2 in the Cells property call to whatever
row number you want (I would presume that would be a For..Next index
counter. If, on the other hand, you were looking for a worksheet formula
solution, put this on Row 2 (assumed to be the first student's row) in
whatever column you will track the last attendance date in and copy it
down...

=INDEX(B$1:J$1,1,SUMPRODUCT(MAX((B2:J2<"")*COLUMN (B2:J2)))-1)

Adjust the top end of the ranges (all the J's to whatever column letter(s)
your last possible date can be in). Note the that final -1 is needed
because the dates are assumed to start in Column B. If the dates actually
start in Column C, then change the -1 to -2.

--
Rick (MVP - Excel)


"bill78759" wrote in message
...
Have worksheet with dates across top and Names down the left side as a
attendance record. Need to examine each Name row to find that last time
the
individual attended (attendance is indicated by x's in the row). The date
would be from the top row in the column corresponding to the x. I first
posted this in the New User group and have one response, but I need
answer
asap. I know that most responders are volunteers and therefore answers
are
given as time permits.