Discussion Locked

Excel formula

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have been trying this one for a while and need some help: I have three cells that can either have an A, B, C or D. I need a formula that can look at the three cells, determine if two or more of them are the same, and then display that letter in a new cell.

Any thoughts?

5 replies

by firstpeter

Let's assume A2, A3, and A4 are your ABCD cells, and A5 is your target cell.

In A5, put the following:
=if(A2=A3,A2,if(A2=A4,A2,if(A3=A4,A3,"NO MATCH")))

That should perform a match for you. You could also build a custom function that would shorten that formula and allow you to compare a much larger number of cells. If you want to go that route, let me know.

by timwalsh

Let's assume the three cells with the values to be checked are A1, A2, and A3. Let's also assume the cell that will have the value copied is B1. And finally we'll assume that if none of the cells match, cell B1 will remain blank.

Based on theseassumptions, you can use a nested IF statement that will be placed in cell B1:

IF(A1=A2,A1,IF(A1=A3,A1,IF(A2=A3,A2,"")))

The IF function has 3 parameters and uses the syntax:
IF(test to conduct, result if true, result if false)

Functionally it works like this:

If cell A1 is equal to cell A2, the contents of cell A1 are copied to cell B1 and the function exits. If not, the function then tests to see if cell A1 is equal to cell A3. If so, the contents of cell A1 are copied to cell B1 and the function exits. If not, the function finally tests to see if cell A2 is equal to cell A3. If so, the contents of cell A2 are copied to cell B1 and the function exits. If not, then none of the cells are equal to any other cell and cell B2 is blanked (or zeroed out) and the function exits.

You can find more information on the IF function by searching Excel Help using the keyword IF.

Hope this helps.

This discussion is closed to new replies.