Google Sheets - Replace Duplicate cells with =[cell] - google-sheets

I've got a google sheet with duplicate cell values. I was wondering if there's a quick and easy way to replace all those duplicates with a reference to just one of them, i.e "=[cell]".

yes, this is possible to do with formula.
Paste this in B2 and copy the formula down:
=if(countif($A$2:A2,A2)>1,"["&ADDRESS(MATCH(A2,A:A,0),COLUMN(A2),4)&"]",A2)
Then to get actual cell refference, use script:
this formula makes text looking like reference: =if(countif($A$2:A2,A2)>1,"="&ADDRESS(MATCH(A2,A:A,0),COLUMN(A2),4),A2)
script must getValues and then setFormulas to range B2:B

Related

How do I add a 0 in front of a string of numbers for all cells?

I need to add a 0 before all cells in the A column on Google Sheets. Is there a code or formatting function I can add in? I need them to look like A2. A3 is what I have right now. There are a total of 783 that were extracted like this and I don't wanna do this manually
I tried formatting a few ways but I'm still a beginner in Sheets & Excel
You can try with ARRAYFORMULA in another column:
=ARRAYFORMULA(0&A1:A)
=INDEX(0&A1:A)
(PS: you may change A1:A with A1:A783)
If you want to just change the values in that column, you may use FIND AND REPLACE --> (Edit -> Find and Replace), be sure you tick "Search using regular expressions". Put to find ^ and to replace 0
NOTE: thanks to #rockinfreakshow, prior this second option, first format to plain text:
And then do the replacement:
You can use this formula in the adjacent cell:
Then you apply it across all your rows.
Do not forget to copy and paste as values.

Google sheets: Arrayformula with importrange

I'm trying to work with combined arrangeformula and importrange formulas. I want that from spreadsheet1:Table1 P4 value would be taken to spreadsheet2 C3 cell: Table2 and only when i add new link to column "L" it will put automatic value at C4. So i want to use arrangeformula so it will work on whole column, but i want to fix that from all the links i add it would take same "P4" value. Possible?
There is no solution. See link1 and link2
All you can is
={IFERROR(IMPORTRANGE($L3;"Lapas1!A2");"");
IFERROR(IMPORTRANGE($L4;"Lapas1!A2");"");
IFERROR(IMPORTRANGE($L5;"Lapas1!A2");"");
IFERROR(IMPORTRANGE($L6;"Lapas1!A2");"")}
as many times as you wish

Google Sheets Copying Conditional Formatting while adjusting formulas

I have a Google Sheets spreadsheet that uses Conditional Formatting using a formula.
So, for the cell range B2:C2, I have the following formula assigned: =if(B2<100,if(C2<80, true,false),false)
This highlights B2 & C2 if B2 is less than 100 AND C2 is less than 80.
This works.
Now, I want to do this for a bunch of rows. However, if I use either copy/paste special or format painter, it does not translate the formula in the conditional formatting to indicate the new row. They all reference row 2.
Is there a way to do this, or do I have to manually add Conditional Formatting to every row?
Or, is there a better way to do this?
Change range to B2:C and forumula to:
=($B2<100)*($C2<80)

Concatenate merged cells with Google Sheets

I have this situation on Google Sheets:
I want to concatenate (=A2&B2) with a merged cell, but only the first cell has a value. I want to get the values of the column "Expected results". How I can detect the first value of each work office in this example?
You can use INDEX/AGGREGATE:
=INDEX($A$1:$A$9,AGGREGATE(14,4,(ISBLANK($A$1:$A$9)=FALSE)*(ROW($A$1:$A$9)<=ROW())*ROW($A$1:$A$9),1)) & B2
Edit for google sheets:
=INDEX($A$1:$A$9,LARGE((ISBLANK($A$1:$A$9)=FALSE)*(ROW($A$1:$A$9)<=ROW())*ROW($A$1:$A$9),1)) & B2
When merging a cell, the content appears only as if it were if the first cell of that block. Hence, you need to only use that first value as your reference. For this you need to block the reference, and it would look like this:
=($A$1&B2)
You can check more information about that in this link.
Try this in D2:
=ARRAYFORMULA(IF(B2:B="",,VLOOKUP(ROW(A2:A),FILTER({ROW(A2:A),A2:A},A2:A<>""),2)&B2:B))

How to insert row with formula that links cell? Google Sheets API

The answer is next:
1) There is formula in Google Sheet cell "A11", for example "=F11+C11";
2) I append multiple data to this Google Sheet list with the help of
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate
or https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append
3) I need to append the value for "A12" using its current position. It had to become "=F12+C12".
Or if I append data on top
(as described here - Google sheets API append method (last on top))
I need that formulas under my append changed to correct value. If current value of "A11" is "=F11+C11" then,
if I add 3 rows before this row, it becomes "A14" cell and it's value had to be changed to "=F14+C14"
Is there any way to realise both this scenarious directly in Google Sheets API request? May be there is some settings in Google Sheet that can help me (something like formating of cells/columns etc)?
UPD. For now it all works fine except of that incident when formula returns exception! My questions is not actual for now, but I still not understand in which cases formulas will change and in which they will not.
The answer is quiet simple!
I update cell 'A13' with formula '=B2+C2' and as cells 'B2' and 'C2' stay on their places after every changes my cell 'A13' still link cells 'B2' and 'C2'.
But if I will add row before 'B2' and/or 'C2' then formula will change and my cell 'A13' will link 'B3' and 'C3'.

Resources