EXCEL 2007 - DUAS ALTERNATIVAS À FUNÇÃO SE (Two Alternatives to IF Function)

Aninhar uma função é usar a sua sintaxe como um dos argumentos de outra função.
Veja-se o exemplo:
= SE (A1 = "Maçãs"; 1; SE (A1 = "Laranjas"; 2; SE (A1 = "Pêras"; 3; SE (A1="Bananas"; 4))))
O Excel 2007 possibilita aninhar a função SE até 64 níveis. Uma enorme melhoria relativamente à versão anterior (Excel 2003) que só permitia 7 níveis.
No entanto, uma fórmula com 64 condições torna-se muito extensa morosa na sua construção e a possibilidade de erro na sua elaboração exige atenção e constante verificação.
Uma das alternativas para evitar esta situação é a utilização da função PROCV.
Consideremos a tabela abaixo:
To nest a IF function is to use its syntax as an argument of another function.
Consider the example:
= IF (A1 = "Apples", 1, IF (A1 = "Oranges", 2, IF (A1 = "Pears", 3, IF (A1 = "Bananas", 4))))
In Excel 2007 its possible to nest the IF function up to 64 levels. A huge improvement over the previous version (Excel 2003) that only allowed seven levels.
However, a formula with 64 conditions is very extensive in its construction and the possibility of error in their development requires constant attention and verification.
An alternative to avoid this is to use the VLOOKUP function.
Consider the table below:


A tabela (azul) contém informação sobre o local , ano de realização e número de equipas dos Campeonatos do Mundo de Futebol desde 1978.

O exemplo "A" contém uma fórmula aninhada nas colunas B e C:
=SE(A12=A2;B2;SE(A12=A3;B2;SE(A12=A4;B4;SE(A12=A5;B5;SE(A12=A6;B6;SE(A12=A7;B7;SE(A12=A8;B8;SE(A12=A9;B9;SE(A12=A10;A10))))))))) - Fórmula em B12

O exemplo "B" contém um fórmula com a função PROCV nas colunas B e C:
=PROCV(A14;A2:C10;2;FALSO) - Fórmula em B14
Os argumentos desta função são os seguintes: A14 é o valor a procurar na primeira coluna da tabela (EUA), A2:C10 é a tabela onde será feita a pesquisa, 2 é a coluna onde queremos encontrar o resultado pretendido (2002), FALSO retorna um valor exactamente igual ao da tabela (se substituirmos por VERDADEIRO, retorna um valor aproximado - mas não se aplica a este exemplo).
Como se pode comprovar, torna-se mais simples e rápido utilizar a função PROCV em vez da função SE aninhada.

O exemplo "C" foi acrescentado como curiosidade. Trata-se de uma simples multiplicação dos argumentos cujo resultado é igual a UM ou ZERO, consoante a correspondência é VERDADEIRA OU FALSA. Em termos de extensão não é muito diferente de uma fórmula aninhada mas torna-se mais simples de construir e o seu cálculo é mais rápido.
=(A16=A2)*B2+(A16=A3)*B3+(A16=A4)*B4+(A16=A5)*B5+(A16=A6)*B6+(A16=A7)*B7+(A16=A8)*B8+(A16=A9)*B9+(A16=A10)*B10 - Fórmula em B16

The table (blue) contains information on the location, year of the event and number of teams of FIFA Soccer World Championships since 1978.

Example "A" contains a nested formula in columns B and C:
=IF(A12=A2,B2,IF(A12=A3,B2,IF(A12=A4,B4,IF(A12=A5,B5,IF(A12=A6,B6,
IF(A12=A7,B7,IF(A12=A8,B8,IF(A12=A9,B9,IF(A12=A10,A10)))))))))
- Formula in B12

Example "B" contains a formula with the VLOOKUP function in columns B and C:
= VLOOKUP (A14, A2: C10, 2, FALSE) 
- Formula in B14

The arguments of this function are: A14 is the value to find in the first column of the table (EUA), A2: C10 is the table where the research will be done, 2 is the column where you want to find the desired result (2002), FALSE returns an exactly value equal to the table (TRUE returns an approximate value - but does not apply to this example).
As can be seen, it is simpler and faster to use the VLOOKUP instead of nested IF function
 
The example "C" was added as a curiosity. It is a simple multiplication of the arguments which result is equal to one or zero, depending on the match is TRUE OR FALSE. In terms of extension is not very different from a nested formula but it is simpler to build and its calculation is faster.
=(A16=A2)*B2+(A16=A3)*B3+(A16=A4)*B4+(A16=A5)*B5+(A16=A6)*B6+(A16=A7)*B7+(A16=A8)*B8+(A16=A9)*B9+(A16=A10)*B10 
- Formula in B16

Comentários

  1. Boa noite. Meu nome é Roberto de Itaquaquecetuba, Brasil.

    Procuro uma alternativa semelhante a apresentada acima, porém, não encontrei e fórmula certa para tal.

    Se puder me ajudar, segue link da publicação.

    http://forum.clubedohardware.com.br/topic/1092150-alternativa-a-fun%C3%A7%C3%A3o-se-no-excel-2007/

    ResponderEliminar

Enviar um comentário

Mensagens populares deste blogue

EXCEL 2007 - FUNÇÕES PARA CALCULAR HORAS (Functions to Calculate Hours)

CONVERTER HORAS EM DIAS DE TRABALHO (Convert Hours to Workdays)

VBA EXCEL - OCULTAR LINHAS EM BRANCO (Hide Blank Rows)