If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Conditional formatting question
I want to apply conditional formatting on column B where the value entered
does not equal a value already entered for the same item in column A Example: Column A Column B Car 1 Lorry 1 Lorry 2 Motorbike 1 Motorbike 1 (false) The last item shows that 1 has already been used for Motorbike. |
#2
|
|||
|
|||
Use FormulaIs and a formula of =COUNTIF($A$1:A1,A1)=1
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Pat" wrote in message ... I want to apply conditional formatting on column B where the value entered does not equal a value already entered for the same item in column A Example: Column A Column B Car 1 Lorry 1 Lorry 2 Motorbike 1 Motorbike 1 (false) The last item shows that 1 has already been used for Motorbike. |
#3
|
|||
|
|||
There is probably a more elegant solution, but:
In your example, suppose that that data starts at row 1 (ie A1 contains "Car"). Then set the conditional formatting of cell B5 to Formula is: =SUM((A$1:A5=A5)*(B$1:B5=B5))2 Copy the formats only up to the other cells in column B (copy cell B5 to the clipboard, then select range B1:B4 and PasteSpecial Formats) -- Return email address is not as DEEP as it appears "Pat" wrote in message ... I want to apply conditional formatting on column B where the value entered does not equal a value already entered for the same item in column A Example: Column A Column B Car 1 Lorry 1 Lorry 2 Motorbike 1 Motorbike 1 (false) The last item shows that 1 has already been used for Motorbike. |
#4
|
|||
|
|||
Sorry gentlemen but I think my question was a bit unclear, let me detail my
example a little better. Example: A1 = Car B1 = 1 A2 = Lorry B2 = 1 A3 = Lorry B3 = 2 A4 = Motorbike B4 = 1 A5 = Motorbike B5 = 2 A6 = Tractor B6 = 1 A7 = Motorbike B7 = 3 A8 = Car B8 = 2 None of the values can be duplicated in col B if there are more than one value similar in col A. If for example I entered 1 in either B5 or B7 a warning will appear to tell me that that value has already been used for that item in col A. Likewise if I entered 2 in B7 and B5 has already the value 2 a warning will appear. Hope this explains what I am trying to achieve a little better. regards Pat "Bob Phillips" wrote in message ... Use FormulaIs and a formula of =COUNTIF($A$1:A1,A1)=1 -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Pat" wrote in message ... I want to apply conditional formatting on column B where the value entered does not equal a value already entered for the same item in column A Example: Column A Column B Car 1 Lorry 1 Lorry 2 Motorbike 1 Motorbike 1 (false) The last item shows that 1 has already been used for Motorbike. |
#5
|
|||
|
|||
On Mon, 23 Aug 2004 22:19:33 +0100, "Pat" wrote:
Sorry gentlemen but I think my question was a bit unclear, let me detail my example a little better. Example: A1 = Car B1 = 1 A2 = Lorry B2 = 1 A3 = Lorry B3 = 2 A4 = Motorbike B4 = 1 A5 = Motorbike B5 = 2 A6 = Tractor B6 = 1 A7 = Motorbike B7 = 3 A8 = Car B8 = 2 None of the values can be duplicated in col B if there are more than one value similar in col A. If for example I entered 1 in either B5 or B7 a warning will appear to tell me that that value has already been used for that item in col A. Likewise if I entered 2 in B7 and B5 has already the value 2 a warning will appear. Hope this explains what I am trying to achieve a little better. If you are manually entering the values (in Col B) then you could use data validation to prevent entering a duplicate value. For example: Select B1:B8 Data/Validation/Allow Custom: Formula: =SUMPRODUCT((A1=$A$1:A1)*(B1=$B$1:B1))=1 With the combination of relative and absolute references in the formula, things should adjust appropriately for each entry. You can then customize the warning box messages as appropriate. Data validation would prevent entering a duplicate value. If you still want to use conditional formatting, then the formula would be: =SUMPRODUCT((A1=$A$1:A1)*(B1=$B$1:B1))1 for an illegal entry. --ron |
#6
|
|||
|
|||
You could generate Column B, as long as you don't
change anything like sorting your rows. B1: =COUNTIF($A$1,$A1) using the fill handle produces B2: =COUNTIF($A$1,$A2) --etc.-- --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Pat" wrote in message ... Sorry gentlemen but I think my question was a bit unclear, let me detail my example a little better. Example: A1 = Car B1 = 1 A2 = Lorry B2 = 1 A3 = Lorry B3 = 2 A4 = Motorbike B4 = 1 A5 = Motorbike B5 = 2 A6 = Tractor B6 = 1 A7 = Motorbike B7 = 3 A8 = Car B8 = 2 None of the values can be duplicated in col B if there are more than one value similar in col A. If for example I entered 1 in either B5 or B7 a warning will appear to tell me that that value has already been used for that item in col A. Likewise if I entered 2 in B7 and B5 has already the value 2 a warning will appear. Hope this explains what I am trying to achieve a little better. regards Pat "Bob Phillips" wrote in message ... Use FormulaIs and a formula of =COUNTIF($A$1:A1,A1)=1 -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Pat" wrote in message ... I want to apply conditional formatting on column B where the value entered does not equal a value already entered for the same item in column A Example: Column A Column B Car 1 Lorry 1 Lorry 2 Motorbike 1 Motorbike 1 (false) The last item shows that 1 has already been used for Motorbike. |
#7
|
|||
|
|||
Still think my earlier response works.
-- Return email address is not as DEEP as it appears "Pat" wrote in message ... Sorry gentlemen but I think my question was a bit unclear, let me detail my example a little better. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pivots and keeping conditional formatting | Jenn | General Discussion | 1 | August 11th, 2004 10:35 PM |
Copy Conditional Formatting | Bianca | Worksheet Functions | 2 | August 9th, 2004 01:47 PM |
applying conditional formatting on empty cell | Tom Ossieur | Worksheet Functions | 2 | February 26th, 2004 12:06 PM |