Q:

Sheet showing available hours between everyone

I want to create a spreadsheet where I can add people on it and see which hours everyone is available to do a online meeting. It's mandatory to consider the timezone but I have no clue how to do it.
Person1 sheet example: 
Matching hours: 
I think my idea of showing 'matches 4 out of 5' is nice, cause the remaining one can make an effort to show up and edit it so it can be like 'matches 5 out of 5'. But any other suggestion is welcome.
The link of the actual spreadsheet(copy to your own drive so you can edit): https://docs.google.com/spreadsheets/d/1yun8uMW2LZUumlm6cy3hqPT-FLQipADSIjLQPNiwXl4/edit?usp=sharing
PS: It would be nice to support DST (daylight save time) but it's not mandatory. The person who is in DST will adjust it.

A:

Assuming your timezone values are all offsets of the Match Sheet (if the match sheet says 01:00 and your timezone is -1, your local time would be 00:00), here is some code that will show you the text in the way that you want:
function availablePeople(startTime, dayOfWeek) { //All slots are 1 hour long
  const sheetsNames = ["person1", "person2", "person3", "person4"]; //Edit this to update possibilities
  const dayHeaderRow = 2;
  const startTimeCol = 1;
  const endTimeCol = 2;

  var sheets = SpreadsheetApp.getActive();

  var referenceHourRow = sheets.getSheetByName("match").getRange(dayHeaderRow+1, startTimeCol, 24).getValues().map(function (x) {return x.toString()}).indexOf(startTime.toString());

  var referenceDayCol = sheets.getSheetByName(sheetsNames[0]).getRange(dayHeaderRow, endTimeCol+1, 1, 7).getValues()[0].indexOf(dayOfWeek);

  var availablePeople = 0;

  if (referenceHourRow != -1) {
    for (var i = 0; i<sheetsNames.length; i++) {
      var personSheet = sheets.getSheetByName(sheetsNames[i]);
      var timezone = -personSheet.getRange(1, 4).getValue();

      var thisDayCol = referenceDayCol;
      var thisHourRow = referenceHourRow;

      if (timezone!=0) {
        if (thisHourRow+timezone<0) {
          //Went back a day.
          thisDayCol = (thisDayCol+6)%7;
          thisHourRow = 24-(referenceHourRow-timezone);
        } else if (thisHourRow+timezone>=24) {
          //Went forward a day
          thisDayCol = (thisDayCol+1)%7;
          thisHourRow = (thisHourRow+timezone)%24;
        } else {
          thisHourRow += timezone;
        }
      }

      var cell = personSheet.getRange(dayHeaderRow+1+thisHourRow, endTimeCol+1+thisDayCol);

      if (cell.getValue()=="Available") {
        availablePeople++;
      }
    }
  }

  return availablePeople+" out of "+sheetsNames.length;
}

This is how to use this function: =availablePeople(<START TIME>,<DAY OF THE WEEK>).
To allow this to be dragged and autocompleted, write =availablePeople($A3,C$2) in the "Monday" "00:00" and then drag it horizontally and vertically to update the formula.

