Compare not-blank cells in row, flag mismatches

joshbjames

New Member
Joined
Jul 25, 2017
Messages
33
I have 6 columns of data that I'd like to check and see if each value in a row are equal. Not every cell in a row has a value and it is a bit tricky for me to come up with a solution.

Here is a bit of sample data, and the kind of flag I'd like to have in column 7.

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
A12968FA12968F
A120E68A120E68
A121915A121915
A121914A121913Error
A120A56A120A56
A1245B0A1245B0
A120A56
A1237DC
A1245C7
A1217D1
A123B14A123B14
A123B33A123B33A123B33A123B33A123B34Error
A12A658A12A658A12A658A12A658A12A658A12A658

<colgroup><col style="width: 100px"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
With your sample data in A1:F17...this regular formula, copied down, flags records with more than one ref value:
Code:
G1: =IF(COUNTIF(A1:F1,INDEX(A1:F1,MATCH("*",A1:F1,0)))=COUNTA(A1:F1),"OK","ERROR")
Is that something you can work with?
 
Upvote 0
Yeah, it looks like it works great, thanks! I had to convert the formulas to values and replace the blanks for some reason, but it was a great solution. I really appreciate it!
 
Upvote 0
I had to convert the formulas to values and replace the blanks ..
IF ..
- You would prefer to leave the formulas in place & still get the results
- The 'blanks' are formulas returning the null string ""
- You have Excel 2016 through Office 365
.. then you could try this alternative, copied down.

Excel Workbook
ABCDEFG
1A12968FA12968F 
2
3A120E68A120E68
4A121915A121915
5A121914A121913Error
6A120A56A120A56
7A1245B0A1245B0
8A120A56
9A1237DC
10A1245C7
11
12
13A1217D1
14
15A123B14A123B14
16A123B33A123B33A123B33A123B33A123B34Error
17A12A658A12A658A12A658A12A658A12A658A12A658
Compare
 
Upvote 0
I'm running into this a bit more, I think I need to upgrade my software. It would have been great to keep my formulas. Thank you for your solution!
 
Upvote 0
Josh
If the contents of the test range will always have 2 or more characters OR formula blanks (=""),
try this:
Code:
G1: =IF(COUNTIF(A1:F1,INDEX(A1:F1,MATCH("??*",A1:F1,0)))=COUNTIF(A1:F1,"??*"),"OK","ERROR")

edited to include this enhancement:
Since formula blanks are zero characters....this (slightly shorter formula) also works:
Code:
G1: =IF(COUNTIF(A1:F1,INDEX(A1:F1,MATCH("?*",A1:F1,0)))=COUNTIF(A1:F1,"?*"),"","ERROR")
Does that solve your problem?
 
Last edited:
Upvote 0
I'm running into this a bit more, I think I need to upgrade my software.
Sounds like you don't meet the Excel 2016 criteria.


It would have been great to keep my formulas.
OK, what about this version (shorter than my last version anyway :))?

Excel Workbook
ABCDEFG
1A12968FA12968F 
2
3A120E68A120E68
4A121915A121915
5A121914A121913Error
6A120A56A120A56
7A1245B0A1245B0
8A120A56
9A1237DC
10A1245C7
11
12
13A1217D1
14
15A123B14A123B14
16A123B33A123B33A123B33A123B33A123B34Error
17A12A658A12A658A12A658A12A658A12A658A12A658
Compare (2)




Edit: If you might want to insert more columns into the range being checked, then this slight modification.

=IF(COUNTIF(A1:F1,INDEX(A1:F1,MATCH("?*",A1:F1,0)))=COLUMNS(A1:F1)-COUNTBLANK(A1:F1),"","Error")
 
Last edited:
Upvote 0
Thank you both again! It took me a few days to get back to this project, but the formulas worked great without me needing to convert formulas or blanks. HUGE HELP, thank you!
 
Upvote 0

Forum statistics

Threads
1,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

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