I have two sheets in Google Sheets. Is it possible to always match two cells? For example Sheet1!A1 with Sheet2!A1 in such a way that if I change the value in Sheet1!A1 the value in Sheet2!A1 changes and if I change the value in Sheet2!A1 it changes in Sheet1!A1
You can do it with the following script:
In general a function with the name
onEdit
fires every time a cell is edited and receives an evente
that saves information about the active sheet and the cell that was edited.The first thing is to get the sheets of your document that you want to connect. In this case the
hoja 1
and thehoja 2
. Then you select the active sheet and the value that the user entered.The two cells connected with dos are filtered
if
, which basically asks:A1
de lahoja 1
, put this value inA1
de lahoja 2
.A1
de lahoja 2
, put this value inA1
de lahoja 1
.That is all. Finally, I remind you that in
Google Sheets
the script code it is inserted in:Herramientas
>Editor de Secuencia de Comandos
Matching Columns
In case you need to match an entire column you can achieve it with minor changes in that script. I attached a little code that you can use:
I attached an example in google Sheets .