Google Sheets: Last Non-Empty Cell - First Non-Empty Cell

mafia97231 Posted messages 27 Registration date   Status Member Last intervention   -  
mafia97231 Posted messages 27 Registration date   Status Member Last intervention   -
Hello,

I have a simplified scheduling table for the occasion.
I applied conditional formatting: the cell changes color (the text as well) when it is not empty.
I want to allow the editor to put anything in the cells (text or number).

Can you help me calculate the hourly range (hours worked during the day + break) for employees?
For calculating the hours worked, I have no problem.

Then, if possible, can you also help me with the calculation of break times?

I'm exploring some options: in cell BE2, the EQUIV function allows me to get the column number of the first non-empty cell. In cell BE6, I manage to get the column number of the last non-empty text cell (it doesn't work if it's a number).

Any suggestions?

My table: https://docs.google.com/spreadsheets/d/1cc9NIdSKQ1jcICDIXQ6Cb0Ftrp8hbnCG_EjFxkvXQwI/edit?usp=sharing

Thank you very much :)

Configuration: Windows / Chrome 92.0.4515.131

6 answers

PapyLuc51 Posted messages 4567 Registration date   Status Member Last intervention   1 511
 
Hello,

I found a matrix formula to calculate the amplitude.

=IFERROR(ArrayFormula(max(IF(B2:BC2<>"";COLUMN(B2:BC2)))-MATCH(TRUE;INDEX(B2:BC2>0;0);0))*0.25/24;"")


For the dwell time
=IF(SUM(BE2;-BD2)=0;"";SUM(BE2;-BD2))


See your example file

Best regards
1