Delete duplicate rows in calc? - duplicates

I have a column in openoffice calc with a set of codes. For example:
B1
B1
Br
Bh
Ht
C3
C3
So what I would like to do is delete all the duplicates so I am left with just:
Br
Bh
Ht
Any help much appreciated.
Cheers

Select the entire range containing data to filter, then click on the menu
Data > Filter > Standard Filter
and:
Use a condition that is always TRUE, like field1 = Not empty
Click on the button more, select Remove Duplicate, select Copy to and put the address of an empty cell
The whole range (without duplicate) will be analyzed and copied at that new address.
source
Or
For both Calc and Excel the quick and dirty solution would be
=COUNTIF($A:$A;$A1)
copied down for every entry in Column A.
All entries where the result is 1 can be filtered as new values.
Calc syntax for COUNTIF:
Source

Related

Can I show the results of COUNTIF in one column only if there is data in another column?

I have a spreadsheet with multiple sheets.
Sheet A is generated from a template, and it is where users will enter in data to be formatted into a report; it will be deleted after that report is submitted.
As people enter info into Column A of Sheet A, they don't have to enter client information if we already have them entered in this spreadsheet, but otherwise they need to go over to Sheet B and enter it in.
To make it easier for them (so they don't have to check every time, or go back and enter info later after getting an error generating the report), I have used conditional formatting. The way it works is, column Z is set up as a helper column, and uses a "COUNTIF" function to check if the client ID in Sheet A, Column A is found in Sheet B, Column C. Sheet A Column Z returns 0 or 1 (or, theoretically, more than one if we had duplicates), and then Sheet A column A has conditional formatting based on Column Z's value-- if the client is already in, the cell for client ID turns green after they type it; if not, it turns red.
It works great! However, I am adding scripts to these sheets, and looping through them. This helper column is filled from Z1 to Z1000, which means I can't use sheet.maxRow() to get the last row.
I see plenty of workarounds on the script side, but I was wondering if anyone has a clever way to input a value into the helper column Z ONLY IF the corresponding cell (same row) in column A has a value using spreadsheet formulas.
I suspect that an array formula with a filter might do it, but I have little experience with either and can't get anything to work out.
Thanks for your help!
You can use this expression with INDEX, MAX and ROW to make an ARRAYFORMULA only expandable until the last cell with value in column:
A2:INDEX(A2:A,MAX(ROW(A2:A)*(A2:A<>"")))
It will go from A2 to the maximum number of row in A in which A is different than null (that's why both conditions are multiplied).
Then you can set a formula like this in Z2 (check the ranges in case something is not right from reading your text, and delete all other formulas in Z too in case you weren't using an arrayformula already):
=BYROW(A2:INDEX(A2:A,MAX(ROW(A2:A)*(A2:A<>""))),LAMBDA(each,IF(each="","",COUNTIF('Sheet B'!C:C,each))))

Pull Entire column from different sheet without zero's

how to pull column from different sheet..
I've a sheet using the below formula to get the column(n rows) from Sheet1 to Sheet2 however I'm getting zeros after nth row. How to avoid zeros here ??
=IF(NOT(ISBLANK(Sheet1!C1)),Sheet1!C:C,"")
I'm doing the same for A,B,C columns to get data from Sheet1 to Sheet2. Any better formula ?
zeros are coming because the original column doesn't have data after nth row. for example if zero occur at 301 for column c means data in the column C has values upto 300 rows.
we can avoid this issue in two ways
stop copying formula after you get zeros
or
Put a unique word in the formula (here stopcopying)
=IF(LEN(IF(NOT(ISBLANK(Sheet1!C12)),Sheet1!C:C,""))=0,"stopcopying",IF(NOT(ISBLANK(Sheet1!C1)),Sheet1!C:C,""))
Find "Stopcopying" keyword and replace without giving any word ( ctrl F and R)
This is the only way I can see and this answered my question:
=FILTER($B:$E,(B:B<>""))

Need to change a sentence to add a word from a list in separate sheet

Hi there and thank you for any support received in advance!
I have a Google Sheets document that has a list of towns in it in two columns on a separate tab and a series of default statements.
I would like to be able to run some form of script or code that automatically changes the "XXXX" and the "ZZZZ" to the appropriate text, as listed in the list of towns (on the second sheet) in any sentence and replaces it with a word from the list of towns. If someone is able to help I would really appreciate it and you can change that document as much as you'd like (it is a demo that I have set up for the purpose of asking this question). I would also appreciate a short explanation as to how you achieve the required result so I can learn and apply this in the future (without having to come back to S.O every time).
NOTE: I need to apply this for 1719 rows in the sheet, and cascade all of the text down it.
Edit: I have completed the first line of the sheet and completed it to the way we need it to be.
Change XXXXXX to ZZZZ and use newest formula
=arrayformula(if(len(C3:C), substitute(substitute(B2, "XXXX",list!A2:A),"ZZZZ",list!B2:B),))
Now no mixing XXXX and XXXXXX
For column B put this formula in cell B3.
For column D put formula in cell D3 and only change B2 to D2.
For column F put formula in cell F3 and only change B2 to F2.
For column L put formula in cell L3 and only change B2 to L2.
For column M put formula in cell M3 and only change B2 to M2. etc.
Like this do for every column you need.
Like other question now you do it 2 times. One for XXXX and one more for ZZZZ. That is why you do substitute again.
Because it is other tab you use list! for ranges there.

using if statement to check for text value

in google sheets im trying to do a formula that first checks if there is text in a cell elsewhere on the page example:
A1 contains text = true then C1/B1 output to D1
A1 contains text = false then D1 = 0
reason im using this is im pulling values from a 2nd sheet using a drop down and populating the results on page 1 but when there is no data to pull for d1 it flags an error #DIV/0! but it has to try pull these rows of data as some data will use the rows.
thanks in advance
Put this in D1:
=IF(A1="",C1/B1,0)

Delete rows on 2 criteria

I have copied over a spreadsheet from a form response to another sheet. The first row contains headers that are used by my pivot.
The rows from this destination sheet should be deleted unless:
Column c = today's date
AND column e = 'Show - Sale'
I have managed to get criteria workong on column e but not on column c (could be down to the way it's formatted??).
I also can't seem to stop it deleting the header row!
Cheers
One equal sign in JavaScript is an assignment operator. For conditional checks in JavaScript you must use either double equal signs or triple equal signs.