Memuat
Memuat
Automatic Sequential IDs for personal shopping and pre-orders
0 views
Every newly filled Data row automatically gets a sequential ID like INV-0001 in column H. Locking prevents duplicate numbers.

Every transaction has a tidy unique number for tracking.
The real project file is available. It is not just the picture above: you get the working file with every formula in place. It can be downloaded after payment, and we send the download link by WhatsApp or email.
ZIP: .xlsx workbook + Apps Script module (.zip)
| Cell | Formula | What it does |
|---|---|---|
| H11 | =COUNTA(Data!H2:H61) | Number of IDs issued. |
| H12 | =IF(COUNTA(Data!H2:H61)=COUNTA(Data!B2:B61),"ID lengkap","Ada baris tanpa ID") | Check every row has an ID. |
| H13 | =IFERROR(INDEX(Data!G2:G61,MATCH(Rekap!H14,Data!H2:H61,0)),"ID tidak ada") | Look up the total by the ID in H14. |
| H15 | =IF(SUMPRODUCT((Data!H2:H61<>"")/COUNTIF(Data!H2:H61,Data!H2:H61&""))=COUNTA(Data!H2:H61),"Tidak ada ID ganda","ID ganda") | Detect duplicate IDs. |
The script is delivered as a separate Code.gs file inside the ZIP. Paste it into Extensions, Apps Script. A short excerpt:
function onEdit(e) {
var sheet = e.range.getSheet();
if (sheet.getName() !== "Data") return;
var baris = e.range.getRow();
if (baris < 2) return;
var kolomId = 8;
var sel = sheet.getRange(baris, kolomId);
var item = sheet.getRange(baris, 2).getValue();
if (item === "" || sel.getValue() !== "") return;
var lock = LockService.getScriptLock();
lock.waitLock(5000);
var props = PropertiesService.getScriptProperties();
var nomor = Number(props.getProperty("nomorTerakhir") || 0) + 1;
props.setProperty("nomorTerakhir", String(nomor));
lock.releaseLock();
sheet.getRange(1, kolomId).setValue("ID");
sel.setValue("INV-" + ("0000" + nomor).slice(-4));
SpreadsheetApp.flush();
}Columns of the Data sheet:
| Requested Item | Item Price |
|---|---|
| Korean Skincare Set | 450,000 |
| Outlet Branded Bag | 1,800,000 |
| Imported Running Shoes | 1,500,000 |
| Japanese Chocolate Box | 120,000 |
| Bandung Cake Souvenirs | 150,000 |
| Premium Coffee Pack | 95,000 |
| Original Perfume 50 ml | 650,000 |
| K-Pop Album Merchandise | 350,000 |
| Collectible Blind Box Toy | 180,000 |
| Shopping Fee per Kg | 50,000 |
The sample data is synthetic.
Yes. The picture above is only a preview. After payment we send the download link of the real project file (a ZIP containing the .xlsx workbook and the macro module) by WhatsApp or email.
No. The sample data is synthetic and only shows how the formulas behave. Replace it with your own data and the formulas keep working.
Yes, as a separate order. Message us on WhatsApp with a short description of your columns and what you want to see.
Sample data is synthetic. Google Sheets is a trademark of Google LLC.
Back to Google Sheets portfolio