I would recommend learning about arrayformulas. But if possible, my higher recommendation would be to attempt to built the logic using glide columns in the data editor. It much easier and the app responds much faster than waiting for data to sync to the sheet, update with a formula, then sync back to the app. Glide columns update instantly on the user’s device.