Using an array based formula in conditional format

2019-07-25 00:40发布

问题:

What I am trying to do with excel is a bit unorthodox, but I need a method of cleaning the data people import in to TechExcel's DevTrack. DevTrack creates values for fields if what you attempt to import is not 100% accurate to what exists already in the project, leading to duplicate values with slightly different formatting.

What I have come to is having a "validator" excel sheet; people copy/paste what they want to import, and anything that doesn't match a data validation table is highlighted.

Data validation itself does not work because copy/paste overwrites it and it is a waste of time to enter data manually.

I have managed to get conditional formatting working partially using this formula: =ISERROR(MATCH(C5,D:D,0))

However it is not case sensitive. I need case sensitivity.

So I managed to create another formula which shows true if there is no match, however exact requires it to be an array formula which doesn't seem to work with conditional formatting.

So this works if it is entered in to a cell with ctrl+shift+enter, but doesn't work as a conditional rule. {=ISERROR(MATCH(TRUE,EXACT(C5,D:D),0))}

Here is a simplified version of what I'm looking at for testing. That formula is true when there is no case match, but I can't enter it in conditional formatting with ctrl+shift+enter. If this worked as I want it to, the lower case "melon" would highlight red.

Is there a way to get this working, or is there an alternative method to do this?

If it matters, I'm using the latest version of excel in office 365.

回答1:

Use a function that produces array processing without CSE. Examples are SUMPRODUCT or AGGREGATE (among others).

'to show TRUE for case-sensitive matches
=SIGN(AGGREGATE(15, 6, ROW($D$5:$D$9999)/EXACT($C5, $D$5:$D999), 1))
'to show TRUE on no case-sensitive match
=ISERROR(AGGREGATE(15, 6, ROW($D$5:$D$9999)/EXACT($C5, $D$5:$D999), 1))

The SIGN wrapper is unnecessary but for me it is a visual reminder that I'm looking for a boolean.

You cannot use dynamic ranges like D5:INDEX(D:D, MATCH("zzz", D:D)) in a CFR and you do not want to use full column references in AGGREGATE (or SUMPRODUCT) so I opted for $D$5:$D$9999.