Exact関数を使うと、ふたつの文字列が一致するかどうかでTrueとFalseを返すことが可能です。A1=B1とかで代用できますが、知っておくとちょっとだけ楽ができます。
成果物

A列とB列をExact関数で比較し、文字列が異なる場合はC列に×を表示してみます。
Exact関数の使い方
文字列を比較し、一致する場合はTrue、異なる場合はFalseを返す
Exact(文字列1,文字列2)
Exact(文字列1,文字列2)

まずはA1とB1を比較したいので、

C1にExact関数を入力します。Exact関数では、英字の大文字、小文字も異なるものとして判別されます(Aとaなど)。

=Exact(A1,B1)と入力してEnterを押し、

結果をオートフィルで下に延ばします。A列とB列の隣り合った文字列が一致する場合はTrue、異なる場合はFalseが返されていることが確認できます。

If文を使って条件分岐する場合は、TrueとFalseが返る=そのまま分岐条件に使えるので、=If(Exact(A1,B1),””,”×”)のように書くことができます。
=If(Exact(A1,B1)=True,””,”×”)のように書いても間違いではないですが、必要はありません。
=If(Exact(A1,B1)=True,””,”×”)のように書いても間違いではないですが、必要はありません。

これを再びオートフィルで延ばすと、文字列が異なった場合のみ×が表示されていることが確認できます。

やりたいことから方法を探すエクセル(Excel)操作・関数・VBA(マクロ)逆引きまとめ
逆引き(やりたいことから探す)Excel記事まとめ

関数・演算子・メソッド・プロパティ名から探すExcel/VBA(マクロ)使い方・組み合わせ方まとめ
こちらはExcelやメソッドの諸機能を、機能の名称から探せるまとめ記事です。
コメント