SI el rango de celdas tiene texto, coincide con la columna A, devuelve S/N

Programa: Excel 2010
Nivel de usuario: Medio

Hola,

I have 6 columns and I need to return a TRUE (Y) o un FALSE ("") value if the text matches in the following:

el nombre en G6 matches the name anywhere in A6:A35, luego regresa "Y", else " "
(Or to save a step, if the text in G6:H6)

Yo he tratado:

=IF(G6=A$6:A$35,"","Y") &   
=IF(G6=A$6:A$35,"Y","")

however I either get the reverse of what I need (Y in no fields) OR I get an NA error.

=IF(A$6:A$35=G7,"Y","")

matches only blank cells in all columns listed.

I would prefer to avoid VLOOKUP.

I want the resulting table to look like:

|  A  |   G   |  H |  K  |  
--------------------------
|Nigel|       |    |     |
|Peter| Nigel |    |  Y  |
|Sally|       |    |     |
|Enid | Peter |    |  Y  |  



|  A  |   G   |  H    |  K  |
-----------------------------
|Nigel|       | Sally |  Y  |
|Peter| Nigel |       |  Y  |
|Sally|       |       |     |
|Enid |       | Nigel |  Y  |

Basically I'm building a relationship builder and I need to know if anyone is related.

A = Child
G = Parent 1
H = Parent 2

Saludos.

preguntado el 24 de mayo de 14 a las 14:05

1 Respuestas

Usar MATCH:

=IF(IFERROR(MATCH(G6,$A$6:$A$35,0),0)+IFERROR(MATCH(H6,$A$6:$A$35,0),0)=0,"","Y")

Two matches in a single IF.

If the first match returns an error, it gets converted to 0. Same for the next. If both are 0, then that means there're no matches; hence "".

Otherwise, if any of the two matches return a number, then return Y.


Thinking about it a bit more, I believe you can use COUNTIF with a shorter formula:

=IF(COUNTIF($A$6:$A$35,G6)+COUNTIF($A$6:$A$35,H6)=0,"","Y")

And on the same line of thinking, to add conditional formatting, I would use three rules, one for each column and all similar.

On range A6:A35, I would use:

=COUNTIF($G$6:$G$35,A6)+COUNTIF($H$6:$H$25,A6)>0

On column G6:G35:

=COUNTIF($A$6:$A$35,G6)>0

On column H6:H35:

=COUNTIF($A$6:$A$35,H6)>0

Note that I'm not relying on Y because in the second option you chose, there can be no Y next to a cell to be highlighted.

contestado el 24 de mayo de 14 a las 20:05

brilliant work, thanks very much, works perfectly. No VLOOKUP which is exactly what I wanted!! Extending that, is there a way to conditionally format from this? If cell = Y, then format then conditional format the name cells? (A, G&H fill blue). Not a gamebreaker, but if I can use that formula that would be great :) - SraAdmin

@MrsAdmin Do you mean like 1, 2 or 3, in esta imagen? ¿O algo mas? - alemán

Yes, exactly like that :) - SraAdmin

@MrsAdmin Like number 1? - alemán

@MrsAdmin Ok, added a part for the conditional formatting in my answer. - alemán

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.