ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   IF stmnt with a nested AND statement - need help (https://www.excelbanter.com/excel-discussion-misc-queries/158652-if-stmnt-nested-statement-need-help.html)

[email protected]

IF stmnt with a nested AND statement - need help
 
Using Excel, I have 3 conditions, lets say a1 is apple, a2 is apple,
a3 is pear.

In C1 - I do a simple if...comparing if a1=a2, "match", else "error"

so then I go to D1 - and i want to focus on the error columns -
catching any instances where the record above may say match in column
C but also that the info in column a matches as well.

This is what i have come up with so far but I am getting a "this
formula has an error" message.
formula for column D ...
=if(d1="match", "match", If(D2="error" and D1="match" and a1=a2,
"match", "error")),

I am comparing cell above to cell below - if match say match.
Then I look at the cell below and if it already says match - leave
alone.... but if it says error - go look at the cell above to see if
the contents in top row top column match the second row top column- if
these match, then say match.... otherwise say error.

Unfortunately the person I am doing this for only has excel and not
access.

Anyone help out here?


Fred Smith

IF stmnt with a nested AND statement - need help
 
To use more than one condition in an If statement, use the And function, as in:

=if(and(d2="error",d1="match",a1=a2),true,false)

--
Regards,
Fred


wrote in message
ps.com...
Using Excel, I have 3 conditions, lets say a1 is apple, a2 is apple,
a3 is pear.

In C1 - I do a simple if...comparing if a1=a2, "match", else "error"

so then I go to D1 - and i want to focus on the error columns -
catching any instances where the record above may say match in column
C but also that the info in column a matches as well.

This is what i have come up with so far but I am getting a "this
formula has an error" message.
formula for column D ...
=if(d1="match", "match", If(D2="error" and D1="match" and a1=a2,
"match", "error")),

I am comparing cell above to cell below - if match say match.
Then I look at the cell below and if it already says match - leave
alone.... but if it says error - go look at the cell above to see if
the contents in top row top column match the second row top column- if
these match, then say match.... otherwise say error.

Unfortunately the person I am doing this for only has excel and not
access.

Anyone help out here?





All times are GMT +1. The time now is 02:44 PM.

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