Hi,
I am making a list of unique stock codes etc for my business, and this turns into a long list.
Is there a way to check if the exact same text that I am entering in column B has already been entered earlier in the sheet?
I know I could sort it, but I am sorting by Product Name, so I just want some sort of visual alert that this code has been used before. It would always be in column B
[Solved] Conditional Format if text is same as another cell
[Solved] Conditional Format if text is same as another cell
Last edited by MrProgrammer on Thu Sep 30, 2021 10:03 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved]
Reason: Tagged ✓ [Solved]
Open Office 4.1.10 on Windows 10 (64 bit)
Re: Conditional Formatting if text is same as another cell
Hey,
Welcome to the forum,
I think that this could be userful for you.
viewtopic.php?f=9&t=105574&p=512564&hil ... te#p513521
Welcome to the forum,
I think that this could be userful for you.
viewtopic.php?f=9&t=105574&p=512564&hil ... te#p513521
LibreOffice 6.3.2.2 Windows 7 Ultimate
-
- Posts: 314
- Joined: Sun Sep 06, 2020 8:27 am
Re: Conditional Formatting if text is same as another cell
You may use
To check only, if the code is used above, you should use a mixture of absolute and relative addressing:
for a value in B5 - adapts to other rows.
So your condition may be
If this works for the single cell you may extend the range for the condition.
J
PS: You can also use validation of data.
A dialog will appear, if your condition is not met.
I use conditional formatting, if the collision just needs double checks and validation, when false values are not allowed.
PPS: A database will prevent this, if column is set UNIQUE.
Code: Select all
COUNTIF(range;value)
Code: Select all
=COUNTIF($B$1:$B5;B5)
So your condition may be
Code: Select all
COUNTIF($B$1:$B5;B5)>1
J
PS: You can also use validation of data.
A dialog will appear, if your condition is not met.
I use conditional formatting, if the collision just needs double checks and validation, when false values are not allowed.
PPS: A database will prevent this, if column is set UNIQUE.
OpenOffice 3.1 on Windows Vista
Re: Conditional Formatting if text is same as another cell
Hi,
Thank you Matareuz but I am really not good with spreadsheets and that post just confused me even more than I already am.
~@mountaineer - =COUNTIF($B$1:$B5;B5) just turned B5 red (I have the conditional formula set up to turn the background red, am hoping if I enter a duplicate that both cells will highlight), the 2nd one didn't seem to do anything (I put the conditional formatting on B5)
I am sorry though I do not know how to extend the range? I am really quite new to all this fancy spreadsheet business and can really only do addition subtraction and multiplication formulas
I honestly don't know what my options are, I know it has to be a spreadsheet (working out profit margins and cost prices, so need those add subtract and multiplication cells) I just want it to alert me (and ideally highlight the duplicate cell) if I type the same code in twice, as I have quite a large stock list to go through and it will take me forever if I have to manually check each one, I thought conditional formula would work but if theres an easier way I'm all ears!
Thank you Matareuz but I am really not good with spreadsheets and that post just confused me even more than I already am.
~@mountaineer - =COUNTIF($B$1:$B5;B5) just turned B5 red (I have the conditional formula set up to turn the background red, am hoping if I enter a duplicate that both cells will highlight), the 2nd one didn't seem to do anything (I put the conditional formatting on B5)
I am sorry though I do not know how to extend the range? I am really quite new to all this fancy spreadsheet business and can really only do addition subtraction and multiplication formulas
I honestly don't know what my options are, I know it has to be a spreadsheet (working out profit margins and cost prices, so need those add subtract and multiplication cells) I just want it to alert me (and ideally highlight the duplicate cell) if I type the same code in twice, as I have quite a large stock list to go through and it will take me forever if I have to manually check each one, I thought conditional formula would work but if theres an easier way I'm all ears!
Open Office 4.1.10 on Windows 10 (64 bit)
Re: Conditional Formatting if text is same as another cell
Select the whole range you want to format conditionally so that B5 is the active input cell and apply the conditional formatting to the selected range based on the formula for B5.
Or copy B5, select the whole range, Edit>Paste-Special... formatting only.
Or copy B5, select the whole range, Edit>Paste-Special... formatting only.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
- MrProgrammer
- Moderator
- Posts: 4905
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Conditional Formatting if text is same as another cell
Hi, and welcome to the forum.
Section 8 explains why the formula below has several $ characters and why $B$2 is different than $B2.
B2, the first cell after the column headings, does not need conditional formatting since the first stock code cannot be a duplicate. [Tutorial] The SUMPRODUCT function
If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
[Tutorial] Ten concepts that every Calc user should knowdejador wrote:I am really quite new to all this fancy spreadsheet business and can really only do addition subtraction and multiplication formula
Section 8 explains why the formula below has several $ characters and why $B$2 is different than $B2.
To alert you if the code has been used before, in cell B3, use Conditional Format formula SUMPRODUCT($B$2:$B2=$B3) as shown in the attachment. It means "are any of the previous cells in column B equal to the current cell?"dejador wrote:I just want some sort of visual alert that this code has been used before. It would always be in column B
B2, the first cell after the column headings, does not need conditional formatting since the first stock code cannot be a duplicate. [Tutorial] The SUMPRODUCT function
Conditional formatting is considered formatting so you can enter it into the first cell where it is needed, B3. Then Edit → Copy (for B3), select the cells in column B where you want that formatting applied, say B4:B999, Edit → Paste Special → ☑Format (uncheck everything else) → OK. You could also use the Format Paintbrush on the Standard Toolbar.dejador wrote:I am sorry though I do not know how to extend the range?
No, B5 can highlight, but the previous cell cannot because there is no way for its formatting to know that B5 is now the active cell. Formula calculations cannot determine which cell is active; they only access cell values. A filter can show all of the rows where the value in column B has some specified value, or the Find command can locate values for you. Read about those suggestions in Help → Index or in User Guides (PDF) or searching for topics about them in the Calc Forum. Learning how to use filters is important if you have a long list.dejador wrote:… turned B5 red (I have the conditional formula set up to turn the background red, am hoping if I enter a duplicate that both cells will highlight)
The formula will detect a duplicate if it matches exactly. Value "Foo" is different than "Foo " (with a trailing space) even though the cell contents will look identical.dejador wrote:the exact same text
If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).