Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    221
    Thanks
    80
    Thanked 3 Times in 2 Posts

    Correct syntax for ElseIf formula

    The formula I'm trying to add to is
    =IF($E$4=C4,B4,"")
    But I need it to go further with a ElseIf

    This ain't working
    =IF($E$4=C4,B4),elseif($A$4 ="0"),$F$4)

    How is it suppose to be ?

    Thanks

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    =IF($E$4=C4,B4,if($A$4 ="0",$F$4,""))
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    3 Star Lounger
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    221
    Thanks
    80
    Thanked 3 Times in 2 Posts
    Thanks Rory, it don't seem to work.
    The formula is in Cell L20

    Cell A4 is actually a 0 or 1 type of "switch".
    So if it's 1, then the first part of the formula works, if it's 0 then the second If has to show the value
    in Cell F4

    Thanks
    Attached Files Attached Files

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    I think your description was inverted from the logic you wanted:
    =IF($A$4 =0,$F$4,IF($E$4=C4,B4,""))
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    XPD,

    Rory's formula works you're just testing it wrong.

    This has 4 Possibilities:

    Possibility 1: If E4=C4 In your example this is True so it displays the value of B4 which is blank or 0.
    Possibility 2: If E4<>C4 Then the second IF will be evaluated leading to 3 & 4.
    Possibility 3: If A4 = 0 Then display F4
    Possibility 4: If A4 <> 0 Then display blank.

    All this works as it should of course you do need to remove the "" around the 0!
    =IF($E$4=$C$4,B4,IF($A$4=0,$F$4,""))

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  6. #6
    3 Star Lounger
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    221
    Thanks
    80
    Thanked 3 Times in 2 Posts
    I see, had the shoe on the wrong foot !
    The RG say's I had the wrong shoes for the right feet, backwards to !


    Thnaks !
    Last edited by XPDiHard; 2015-06-03 at 11:02.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •