Complex Condition

AndrewGL

New Member
Joined
Jul 6, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello :)

I'm trying to do what I think is a complex condition in Excel.

In the below spreadsheet example:
  • I want the user to be able to enter a Buying Style Ref (Column A) multiples times based on certain conditions.
  • If the user enters a duplicate Buying Style Ref multiple times. Then the data must match the data in Columns E, F and G of the previously entered Buying Style Ref: for example:
    • Row 5 and Row 6 = correct
    • Row 7 = incorrect, as it does not match the original data in the first instance (Row 5) (E7 does not match E5)

In simple terms every time a User enters data into a row I want it do the following logic:
  1. Does Buying Style Ref already exist.
    • If 'yes'
      • Does the data in Column E match with the first instance?
        • Yes - leave white
        • No - highlight red
      • Does the data in Column F match with the first instance?
        • Yes - leave white
        • No - highlight red
      • Does the data in Column G match with the first instance?
        • yes - leave white
        • No - highlight red
example.png
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
MrExcelPlayground2.xlsm
QRST
1StyleXYZ
2A1100CottonKnitChina
3A1100CottonKnitChina
4A150Cotton50RabbitKnitChina
5B1SilkperlNew Jersey
6C1RubbercastMexico
7A1100CottonOtherthingChina
8B1SilkperlTrenton
Sheet38
Cells with Conditional Formatting
CellConditionCell FormatStop If True
R3:T8Expression=IF(NOT(ISNA(MATCH($Q3,$Q$2:$Q2,0))),IF(R3=INDEX(R$2:R2,MATCH($Q3,$Q$2:$Q2,0)),FALSE,TRUE),FALSE)textNO
 
Upvote 0
MrExcelPlayground2.xlsm
QRST
1StyleXYZ
2A1100CottonKnitChina
3A1100CottonKnitChina
4A150Cotton50RabbitKnitChina
5B1SilkperlNew Jersey
6C1RubbercastMexico
7A1100CottonOtherthingChina
8B1SilkperlTrenton
Sheet38
Cells with Conditional Formatting
CellConditionCell FormatStop If True
R3:T8Expression=IF(NOT(ISNA(MATCH($Q3,$Q$2:$Q2,0))),IF(R3=INDEX(R$2:R2,MATCH($Q3,$Q$2:$Q2,0)),FALSE,TRUE),FALSE)textNO
Hi James,

This looks amazing thank you !!!!!!!

I've slighty adapted your Conditional Formatting to match the cells and columns of my excel spreasheet. However, I'm not getting the same results as you. I can't see what I'm doing wrong.

=IF(NOT(ISNA(MATCH($A6,$A$5:$A5,0))),IF(E6=INDEX(E$5:E5,MATCH($A6,$A$5:$A5,0)),FALSE,TRUE),FALSE)

New.png
 
Upvote 0
Any chance you can download the XL2BB addin from this site - it makes posting easier. I can't say why yours doesn't work - it looks right. It's giving me flashbacks to a similar problem a few weeks ago.

Any chance there are some invisible differences in the cells, like an extra space after 100% Cotton_ or something like that? And I couldn't say why G12 is red.
 
Upvote 0
Any chance you can download the XL2BB addin from this site - it makes posting easier. I can't say why yours doesn't work - it looks right. It's giving me flashbacks to a similar problem a few weeks ago.

Any chance there are some invisible differences in the cells, like an extra space after 100% Cotton_ or something like that? And I couldn't say why G12 is red.
 
Upvote 0
Hello :)

Yes, sorry, I was being an idiot. I can't thank you enough for your help:

Commodity Code Sheet test example - Copy.xlsx
ABCDEFGHIJKL
1DEPARTMENT & TEAM:Enter your department name and team here
2BUYERS & MERCHANDISERSCUSTOMS TEAM
3BUYING STYLE REFIMAGEPRODUCT TYPEDESCRIPTION - NB DO NOT USE THE WORD "TOP"!!PRODUCT COMPOSITION (MATERIAL)KNITTED OR WOVENPREFERENCE COUNTYPREFERENCE CODECOMMODITY CODEDUTY RATEBUYER COMMENTSIMPORTS COMMENTS
4The buying style reference numberIf you feel it is necessary or helpful, please, insert an imageInsert gender & if required if for boys or girlsSuch as 65% Poly / 35% Cotton If not applicable leave blankPlease add any comments if neededPlease add any comments if needed
5ABS21TT001Ladies Black T-shirt100% CottonKnittedChina
6ABS21TT001Ladies Red T-shirt100% CottonKnittedChina
7ABS21TT001Ladies White T-shirt50% Cotton 50% WoolKnittedChina
8ABS21TT001Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
9ABS21TT002Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
10ABS21TT003Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
11ABS21TT004Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
12ABS21TT005Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
13ABS21TT005Ladies Red T-shirt50% Cotton 50% WoolKnittedIndia
14ABS21TT005Ladies White T-shirt50% Cotton 50% WoolKnittedFrance
15ABS21TT001Ladies Black T-shirt100% CottonKnittedItaly
Clothing & Accessories
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E6:G102Expression=IF(NOT(ISNA(MATCH($A7,$A$5:$A6,0))),IF(E7=INDEX(E$5:E6,MATCH($A7,$A$5:$A6,0)),FALSE,TRUE),FALSE)textYES
Cells with Data Validation
CellAllowCriteria
A5:A15Custom=AND(COUNTIF($A$5:$A$500,A5)=1, LEN(A5)=10)
 
Upvote 0
It looks like your conditional formatting formulas are off by one row:
MrExcelPlayground2.xlsm
ABCDEFG
1DEPARTMENT & TEAM:Enter your department name and team here
2BUYERS & MERCHANDISERS
3BUYING STYLE REFIMAGEPRODUCT TYPEDESCRIPTION - NB DO NOT USE THE WORD "TOP"!!PRODUCT COMPOSITION (MATERIAL)KNITTED OR WOVENPREFERENCE COUNTY
4The buying style reference numberIf you feel it is necessary or helpful, please, insert an imageInsert gender & if required if for boys or girlsSuch as 65% Poly / 35% Cotton If not applicable leave blank
5ABS21TT001Ladies Black T-shirt100% CottonKnittedChina
6ABS21TT001Ladies Red T-shirt100% CottonKnittedChina
7ABS21TT001Ladies White T-shirt50% Cotton 50% WoolKnittedChina
8ABS21TT001Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
9ABS21TT002Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
10ABS21TT003Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
11ABS21TT004Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
12ABS21TT005Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
13ABS21TT005Ladies Red T-shirt50% Cotton 50% WoolKnittedIndia
14ABS21TT005Ladies White T-shirt50% Cotton 50% WoolKnittedFrance
15ABS21TT001Ladies Black T-shirt100% CottonKnittedItaly
Sheet39
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E6:G15Expression=IF(NOT(ISNA(MATCH($A6,$A$5:$A5,0))),IF(E6=INDEX(E$5:E5,MATCH($A6,$A$5:$A5,0)),FALSE,TRUE),FALSE)textNO
 
Upvote 0
Solution
It looks like your conditional formatting formulas are off by one row:
MrExcelPlayground2.xlsm
ABCDEFG
1DEPARTMENT & TEAM:Enter your department name and team here
2BUYERS & MERCHANDISERS
3BUYING STYLE REFIMAGEPRODUCT TYPEDESCRIPTION - NB DO NOT USE THE WORD "TOP"!!PRODUCT COMPOSITION (MATERIAL)KNITTED OR WOVENPREFERENCE COUNTY
4The buying style reference numberIf you feel it is necessary or helpful, please, insert an imageInsert gender & if required if for boys or girlsSuch as 65% Poly / 35% Cotton If not applicable leave blank
5ABS21TT001Ladies Black T-shirt100% CottonKnittedChina
6ABS21TT001Ladies Red T-shirt100% CottonKnittedChina
7ABS21TT001Ladies White T-shirt50% Cotton 50% WoolKnittedChina
8ABS21TT001Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
9ABS21TT002Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
10ABS21TT003Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
11ABS21TT004Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
12ABS21TT005Ladies Black T-shirt50% Cotton 50% WoolKnittedChina
13ABS21TT005Ladies Red T-shirt50% Cotton 50% WoolKnittedIndia
14ABS21TT005Ladies White T-shirt50% Cotton 50% WoolKnittedFrance
15ABS21TT001Ladies Black T-shirt100% CottonKnittedItaly
Sheet39
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E6:G15Expression=IF(NOT(ISNA(MATCH($A6,$A$5:$A5,0))),IF(E6=INDEX(E$5:E5,MATCH($A6,$A$5:$A5,0)),FALSE,TRUE),FALSE)textNO
YOU ARE AMAZING !!!!!!!!

THANK YOU THANK YOU THANK YOU
 
Upvote 0

Forum statistics

Threads
1,214,894
Messages
6,122,124
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top