ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Nested If/and statement (https://www.excelbanter.com/excel-worksheet-functions/177768-nested-if-statement.html)

ScoobyDoo

Nested If/and statement
 
Hi, I would like to be able to return some text based on the numbers compared
in 2 cells v another 2 cells i.e.

if N16 N15 and M16 < M15, "No change", if N16 = N15 and M16 < M15 "No
Change", if N16 = N15 and M16 = M15 "Increase", if N16 = N15 and M16 M15
"Calsurp", if N16 < N15 and M16 < M15 "Inccal", if N16 < N15 and M16 =M15
"Skip", if N16 n15 and m16 = m15 "incrcal", if n16 n15 and m16 m15
"Incrcal calsurp"

Any help with the above would be grately appreciated, thanks in advance

David Biddulph[_2_]

Nested If/and statement
 
Easiest in this sort of case to avoid the AND function and test column N as
the outer loop of the test, then for each column N condition have an inner
loop with the 3 choices for column M, hence something like:
=IF(N16N15,IF(M16<M15,"No change",IF(M16=M15,"incrcal","Incrcal
cslsurp")),IF(N16=N15,IF(M16<M15,"No Change",IF(M16=M15,...
and complete as appropriate.
--
David Biddulph

"ScoobyDoo" wrote in message
...
Hi, I would like to be able to return some text based on the numbers
compared
in 2 cells v another 2 cells i.e.

if N16 N15 and M16 < M15, "No change", if N16 = N15 and M16 < M15 "No
Change", if N16 = N15 and M16 = M15 "Increase", if N16 = N15 and M16 M15
"Calsurp", if N16 < N15 and M16 < M15 "Inccal", if N16 < N15 and M16 =M15
"Skip", if N16 n15 and m16 = m15 "incrcal", if n16 n15 and m16 m15
"Incrcal calsurp"

Any help with the above would be grately appreciated, thanks in advance




Rick Rothstein \(MVP - VB\)[_96_]

Nested If/and statement
 
Here is a different approach which should do what you want...

=IF(COUNT(N15,N16,M15,M16)=4,CHOOSE(3*SIGN(N16-N15)+SIGN(M16-M15)+5,"Incal","Skip","Skip","No
change","Increase","Calsurp","No change","Incrcal","Incral calsurp"),"")

Rick


"ScoobyDoo" wrote in message
...
Hi, I would like to be able to return some text based on the numbers
compared
in 2 cells v another 2 cells i.e.

if N16 N15 and M16 < M15, "No change", if N16 = N15 and M16 < M15 "No
Change", if N16 = N15 and M16 = M15 "Increase", if N16 = N15 and M16 M15
"Calsurp", if N16 < N15 and M16 < M15 "Inccal", if N16 < N15 and M16 =M15
"Skip", if N16 n15 and m16 = m15 "incrcal", if n16 n15 and m16 m15
"Incrcal calsurp"

Any help with the above would be grately appreciated, thanks in advance




All times are GMT +1. The time now is 10:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com