You are here:

# Excel/Question

Question
When looking at an array of numbers

0 0 0 1 1 2 2 2 2 3 3 3 3 3 3 2 2 2 1 1 0 0 0 0 0

Each corresponding in a column under a time (ie in this example the array starts at 630 am and goes by 15 minute intervals to 9am then goes from 3pm to 6pm in 15 minute intervals - so at 715 and we go need 1 teacher, at 745am we need 2 teachers and at 845 we need three teachers.

I need to be able to have excel look at the full array and send me data back like:

Staffing needs
715am - 1 teacher
745am - 2 teachers
845am - 3 teachers
415pm - 2 teachers
500pm - 1 teacher
530PM - 0 teachers

can you help me??>

(found in the question pool)
I think I would be inclined to do this with the MATCH function - AS LONG as you know the maximum number of teachers you are going to need

With 1 stored in cell A4, and with the data in A1:X2 (in my working example) the formula in B4 would be

=MATCH(A4,\$A\$2:\$X\$2,0)

This function will work for the increasing number of teachers - for the decreasing amount you would need to offset the data - so

=MATCH(A7,OFFSET(\$A\$2:\$X\$2,0,\$B\$6),0)+B6

where row 6 contains the maximum number of teachers used.

These cells return the column number of the time, so by using the INDEX function you can get the time that this equates to

=INDEX(\$A\$1:\$Z\$1,1,B4)

I hope that this makes sense - do let me know if I can help further.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Aidan Heritage

##### Expertise

I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world!

##### Experience

My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

Education/Credentials
I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!