You don't need a script: the Filter command (which is different from filters and filter views) does this easily.
Suppose your master sheet is named Master and the closing date is in column B. Then in Sheet "Jan" you would enter
=filter(Master!A:Z, month(Master!B:B) = 1)
Here A:Z are the columns of Master sheet (of course there may be more, you can use A:ZZ, etc). The condition that month of the date in column B is equal to 1 means it's January.
In the sheet named "Feb" you would put
=filter(Master!A:Z, month(Master!B:B) = 2)
and so on. The edits to Master sheet will be immediately reflected in the month sheets.
This can be done with a script, using insertSheet method which takes the new sheet name and the template after which it's to be created. The first function adds a custom menu item when the spreadsheet is opened, the second performs duplication when that menu item is invoked.
As far as I can tell, the contents are copied over in the same way as they are with "Duplicate" function.
function onOpen() {
var menu = [{name: "Duplicate and name", functionName: "dupName"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu("Custom", menu);
}
function dupName() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var name = Browser.inputBox('Enter new sheet name');
ss.insertSheet(name, {template: sheet});
}
Best Answer
Given the range and examples in your post, try this:
=INDIRECT(A3&"!A1")