Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

If then else rules in excel

Hi all -

I need to create a rule which I could then copy and apply to all cells in a table.

If        C8 = 'S'
and     C9 = 'A'
and     S8 = 1
and     S9 = 2

then concat =C9 + ' ' + "\" + ...

ELSE

If If        C8 = 'S'
and     C9 = 'S'
and     S8 = 1
and     S9 = 1

THEN CONCAT= C9 + C10 + ' ' + "\" + ...
0
hwassinger
Asked:
hwassinger
  • 2
1 Solution
 
rspahitzCommented:
That should be something like this:

=IF( AND( C8="S", C9="A", S8=1, S9=2 ), C9+"\"+... ,
   IF( AND( C8="S", C9="S", S8=1, S9=1 ), C9+C10+"\"+... , ??? ) )
0
 
mcsweenSr. Network AdministratorCommented:
Excel IF function is If Else by default.  Syntax is

=IF(Test,truestatement,falsestatement)

If you need to test for more than one thing you need to use the AND function.  The following code tests to see if A1, B1, C1, and D1 = 1.  If true it sums them, otherwise it CONCATENATES the words "It's" and "False"  True should return the number 4, false will write the text "It's False"
=IF(AND(A1=1,B1=1,C1=1,D1=1),SUM(A1:D1),CONCATENATE("It's ","False"))

Open in new window

0
 
rspahitzCommented:
=IF( AND( C8="S", C9="A", S8=1, S9=2 ), C9&"\"&... ,
   IF( AND( C8="S", C9="S", S8=1, S9=1 ), C9&C10&"\"&... , "Neither test was matched" ) )

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now