3 cells - Return a value in the 4th cell if they match or are different

H3MSY

Board Regular
Joined
Apr 29, 2002
Messages
69
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have done a search but cant quite get what I need - Hopefully this is pretty simple for the resident experts!! ;)

I have multiple rows of 3 columns (A/B/C) that could be blank or could contain 3 or 4 different sets of text. They start out as blanks and don't have to be populated as such.

What I want in column D is a formula that looks at A,B & C and if they have text in them and that text is different return the text "diff" otherwise "ok"

examples
row 1 could be: (blank), Red, Red = ok
row 2 could be: Red, Red, Red = ok
row 3 could be: Red, blue, blue = Diff
row 4 could be: (blank), (blank), blue = ok

I think its the blank cells that potentially going to throw a spanner in the works. I guess the formula needs to 'ignore blanks' somehow,

Many thanks for any help given
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
i think this answers

just modifying the range

Book2
ABCDEFG
1
2redredOKrow 1 could be: (blank), Red, Red = ok
3redredredOKrow 2 could be: Red, Red, Red = ok
4redblueblueDifferencerow 3 could be: Red, blue, blue = Diff
5blueOKrow 4 could be: (blank), (blank), blue = ok
6
Sheet1
Cell Formulas
RangeFormula
D2:D5D2=IF(COUNTA(A2:C2)-COUNTIF(A2:C2,LOOKUP(2,1/(A2:C2<>""),A2:C2))=0,"OK","Difference")


or from the link - sumproduct

Book2
ABCDEFGHIJK
1countsumproduct
2redredOKOKrow 1 could be: (blank), Red, Red = ok
3redredredOKOKrow 2 could be: Red, Red, Red = ok
4redblueblueDifferenceDifferencerow 3 could be: Red, blue, blue = Diff
5blueOKOKrow 4 could be: (blank), (blank), blue = ok
6
7
Sheet1
Cell Formulas
RangeFormula
D2:D5D2=IF(COUNTA(A2:C2)-COUNTIF(A2:C2,LOOKUP(2,1/(A2:C2<>""),A2:C2))=0,"OK","Difference")
F2:F5F2=IF(SUMPRODUCT(--(A2:C2<> ""))-COUNTIF(A2:C2,LOOKUP(2,1/(A2:C2<>""),A2:C2))=0,"OK","Difference")
 
Upvote 0
What version of Excel are you using?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
i think this answers

just modifying the range

Book2
ABCDEFG
1
2redredOKrow 1 could be: (blank), Red, Red = ok
3redredredOKrow 2 could be: Red, Red, Red = ok
4redblueblueDifferencerow 3 could be: Red, blue, blue = Diff
5blueOKrow 4 could be: (blank), (blank), blue = ok
6
Sheet1
Cell Formulas
RangeFormula
D2:D5D2=IF(COUNTA(A2:C2)-COUNTIF(A2:C2,LOOKUP(2,1/(A2:C2<>""),A2:C2))=0,"OK","Difference")


or from the link - sumproduct

Book2
ABCDEFGHIJK
1countsumproduct
2redredOKOKrow 1 could be: (blank), Red, Red = ok
3redredredOKOKrow 2 could be: Red, Red, Red = ok
4redblueblueDifferenceDifferencerow 3 could be: Red, blue, blue = Diff
5blueOKOKrow 4 could be: (blank), (blank), blue = ok
6
7
Sheet1
Cell Formulas
RangeFormula
D2:D5D2=IF(COUNTA(A2:C2)-COUNTIF(A2:C2,LOOKUP(2,1/(A2:C2<>""),A2:C2))=0,"OK","Difference")
F2:F5F2=IF(SUMPRODUCT(--(A2:C2<> ""))-COUNTIF(A2:C2,LOOKUP(2,1/(A2:C2<>""),A2:C2))=0,"OK","Difference")
etaf, many thanks this works perfectly. Thanks for taking the time out to reply. Have a great day
 
Upvote 0
What version of Excel are you using?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Done!! (i think). Thanks for the advice Fluff
 
Upvote 0
As you have 365 another option is
Excel Formula:
=IF(COUNTA(UNIQUE(FILTER(A2:C2,A2:C2<>""),1))=1,"OK","Difference")
 
Upvote 0

Forum statistics

Threads
1,215,766
Messages
6,126,760
Members
449,336
Latest member
p17tootie

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