Highlight duplicate values - formatting

In Excel, Office 2007, I have the option to highlight duplicate values on the menu. Keep simple! Select the column, select "Conditional Formatting" - "Highlight Cells Rules" - "Duplicate Values" and voilá! All values that were duplicate on this column it was paint with color red, for example.
Actually I use the LibreOffice Calc, version 5.0.3.2, and I can't find this option on the menu!
How can I do this job?

Select the column of numbers and note the 'active cell' (A1 in the sample image below). Go to Format ► Conditional Formatting and set up a rule as a formula using COUNTIF(A$1:A$15; A1)>1.
   
It is important to get the 'active cell' correct. If the 'active cell' was A15 then that formula would be COUNTIF(A$1:A$15; A15)>1.
I've also put the formula in column C so that you can see how each row resolved to TRUE or FALSE.

In LibreOffice Calc 6.0.7.3 this can be done by following these steps (from this link):
Select column A by clicking on the header character A (the top of the column)
Select the menu: Format -> Conditional -> Condition...
Condition 1: Cell value is and select duplicate from the dropdown
Apply Style: Select your cell style (e.g. Error or any you defined in advance)
Check that your cell range is A1:A1048576 (You may want to reduce the 1048576 to any reasonable number you assume will be the maximum to ever be used)
Click OK button

Not exactly the solution to this specific question, but I find the following comes in very handy when you have the column in question sorted, especially when you are sorting by multiple columns:
If you want to format any value in a cell that is a duplicate of the one immediately above it, select the entire column and use the following formula in Conditional Formatting
(INDIRECT(CELL("address"))=OFFSET(INDIRECT(CELL("address"));-1;0))
In a sorted column, the first occurrence of a value will be considered "unique" in that it hasn't occurred yet, and then all of the duplicates which follow immediately afterward are flagged (I usually use a light grey for the font color). If the column is not the major order (ie 2nd or later in the sort criteria) then the "uniqueness" is effectively "reset" each time sorting starts over for this column.

Related

Excel Macro to validate 2 columns based on cell values

I am at initial stage in creating Macros. I know how to validate one column at a time, but not sure about validating a column reference to other column in the same row. Hope someone will help me with this!
Scenario: validate 2 columns in a spreadsheet (debit and credit columns).
Condition: For every filled row, I should have one of the two column values as "0",
highlight both the columns if non of the column value is "0".
Don't use VBA, use the built-in Conditional Formatting.
Assuming those columns are A and B, let's say A2:A10 and the Credit is B2:B10.
Go to Conditional Formatting, New Rule.
Select "Use a formula to determine ..." and type in =AND($A2<>0,$B2<>0,$A2<>"",$B2<>""). Then click "Format" and Fill Red.
Then click "Ok", "Ok" and change "Applies to" range to $A$2:$B$10.

How to use vba to filer a column using value from a specific cell

I want to use a macro to filter columns in a table. I want to filter for values that are higher than a value I want to put in cell, to be able to easily change the filter. Does someone have a trick for doing this with vba?
Many thanks, Bram
Record a macro whilst filtering a table on a column value. You would right click on the table column header of interest whilst recording the code and select Number_Filters > Greater Than and enter your desired number. That would give you the outline code. You can then amend the code to pick up the desired value from a specified cell. If applying filter to multiple columns record macro whilst doing this process over several columns.
Thank you for you answer. I tried this already, but I could not get the macro to pick from a specific cell. If I stored the value of the specific cell under as 'value' and put that in the outlined code, it would just do Greater Than value.. DO you have shortcut for this?
Thanks!

VBA - How to fill the data to specific column by referred to another column on the same sheet

How can I automatically fill data into a specific column by referring to a different source-column on the same sheet?
Example:
In the source column are the numbers 1 to 10. How can I convert this into e.g. having "1" displayed as "One" in the second column?
If you just want to spell the number in the first column, then:-
Setup your column headers and format the area as a table (From Ribbon -> "Home" => "Format as Table").
Using the instructions from this Microsoft Support article (https://support.microsoft.com/en-us/kb/213360/en-us), add the code from the article into a VBA Module in the workbook.
Assuming your first data cell is "A2", add this formula to cell "B2":- =SpellNumber(A2). Since it is a table, the formula will be propagated down that entire column automatically, even when adding new rows.
You will need to modify the code from the MS Support article, as it is designed for returning Dollars & Cents phrases.
without know that you really want, You can see convert a numeric value into English words in Excel
PS: joehanna sorry, I'm not saw your answer

VBA msgbox duplicate value base on 2 columns

I'm trying to get a msgbox when a value is duplicate base on 2 columns. The first column Value can be repeated but the second column will determine if it's a duplicate or not.
i.e.
Column B = Code,
Column L = Month
The user can enter the Code several times, but if he enters it on the same month I want the msgbox pop up
Is your intention to warn\inform the user? If so, I would do this without a macro. I would use conditional formatting to make the cell change color whenever the duplicate information is entered.
Create a column on your worksheet with a formula that concatenates the information in column B&L the formula would be =B1&L1 (copy this formula down the table). You can hide the column so nobody sees it. For this example, let's say you used column "M".
Select the entire Code or Month column (or both) and click the CONDITIONAL FORMATTING button on the Home tab, choose NEW RULE, USE FORMULA TO DETERMINE WHICH CELLS TO FORMAT, then enter the following formula: =COUNTIF($M$4:$M$1000,M1)>1 (note I am assuming your range of data is less than 1000 records, otherwise increase that number). Set the format to something like a red fill and instantly duplicates will be flagged. The user will also be able to quickly locate the record where this combination was already entered as that will turn red too.
If you really do want a macro to do this, you could simply write a loop to compares the active cell value of B(activerow) & L(activerow) to each previous B#&L# combination. If a match is found, use the intersect method to pop-up a the message. Here is really a good article about the intersect method: http://www.ozgrid.com/VBA/vba-intersect.htm.

Formatting row by row with conditional formatting in Excel

Let's say I have 2 columns that I'm comparing data in. If both cells match I want both cells to turn green. If they don't match I want them to turn yellow. Is there a formula that will allow me to check this for multiple records, or would this require looping in VBA? I can only seem to make this work 1 record at a time using conditional formatting. Thanks!
Edit: Adding results from provided answer
You can use conditional formatting, but you'll have to format each of the two columns separately.
Say your data is in A2:B100 (for simplicity)
Select the cells in columnA (A2:A100)
Select conditional Formatting >> New Rule >> Use a formula...
Enter the formula "=A3<>B3", choose a format and click OK
Repeat on column B.