Conditional formatting with strcomp fails

T

terry.bell

I've been trying to set up conditional formatting based on the values
in two cells, and wanting case sensitivity, using strcomp.

A simplified example of the problem:
Formula
=$A1<>$A2 works fine, and the chosen format is evident only if the
values in A1 and A2 are different.

But anything with the strcomp function doesn't work.
eg if I put in a formula
=strcomp($B1,$B2) <> 0
=strcomp($B1,$B2,0) <> 0
=strcomp($B1,$B2) = 0
=strcomp($B1,$B2,0) = 0
=strcomp($B1,$B2)
Doesn't matter what values I put in, can't get the format to show.

TIA
Terry
 
R

Roger Govier

Hi Terry

Never heard of strcomp. It has to be a function that has been written
specifically by/for you and is loaded on your machine.
Why not use the inbuilt Excel function - Exact
=EXACT($B1,$B2)
It will return True or false dependent upon the contents of the 2 cells.
 
T

terry.bell

Thanks for the prompt reply Bob,Roger.
You've both blown my cover - I'm really an Access developer - and have
got myself in strife wandering around Excel VBA. I thought VBA was
supposed to be seamless across the Office products but ...
I find on my machines, Help, invoked from the VBA part of Excel, will
tell you strcomp is a valid function that does exactly what I want it
to do.
I certainly haven't written my own function, though the thought
crossed my mind.
Roger, Exact looks like Exactly what I want - I'll try it on site
tomorrow.
Still, seems rather rude that Excel syntactically accepts strcomp, but
does b*gger all with it ...
Cheers
Terry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top