+ Reply to Thread
Results 1 to 11 of 11

formula gives result only if condition is satisfied, otherwise empty cell

  1. #1
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    formula gives result only if condition is satisfied, otherwise empty cell

    Dear experts,
    I am struggling with a sheet which have a formula in C column but it does not appears, it only appears when value in respective cell D is "y" as shown. I do not know how to apply this condition.Any help or clue is greatly appreciated!
    A-----------------B-----------------C-----------------------------------D
    1-----------------2----------=if($D1="y",sum($A1:$B1))------------------y
    5-----------------4----------=if($D2="y",sum($A2:$B2))------------------y
    6-----------------7-----------no formula-------------------------------- n
    8-----------------2----------=if($D4="y",sum($A4:$B4))------------------y
    and so on
    ....
    Last edited by shaukat; 12-09-2011 at 11:03 AM. Reason: changed the title according to case

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: formula appear only if condition is satisfied, otherwise empty cell

    Hi shaukat

    I don't understand what you mean "is not appears".

    For me it's appears.

    I make an example for you.

    Let us know where is the problem, using the example Sheet.
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: formula appear only if condition is satisfied, otherwise empty cell

    =if($D1="y",sum($A1:$B1))

    Do you mean:

    =if($D1="y",sum($A1:$B1),"")


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: formula appear only if condition is satisfied, otherwise empty cell

    hello Fotis
    thanks for pasting this example. this is exactly same senerio, But I do not know how to set up the formula like this.
    can you tell me the steps
    Thanks a Lot!

  5. #5
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: formula appear only if condition is satisfied, otherwise empty cell

    I mean how to make the formula auto-fill when condition is satisfied, normally I have to drag formula down to the end

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: formula appear only if condition is satisfied, otherwise empty cell

    Hi shaukat

    I mean how to make the formula auto-fill when condition is satisfied, normally I have to drag formula down to the end
    Yes! This is the way to go on... And don't forget to use the $ symbl, as TMShucks, proposed you.


    =IF($D1="y";SUM($A1:$B1);"")


    Hope to helps you.

  7. #7
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: formula appear only if condition is satisfied, otherwise empty cell

    Hi Fotis,
    but I see your example has commas instead of semicolon , does it make difference? because when I made formula, it is giving error with semi-colon.But normal formula with comma doesn't preform auto fill for me.

  8. #8
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: formula appear only if condition is satisfied, otherwise empty cell

    please see my case, it did not fill in the cells beneath
    Attached Files Attached Files

  9. #9
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: formula appear only if condition is satisfied, otherwise empty cell

    shaukat, when we "write" a formula in Excel. we use semicolon.

    In your example, i just fill the last cell...

    Is it OK now?
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: formula appear only if condition is satisfied, otherwise empty cell

    Thanks Fotis, Enjoy your weekend. It was simple as you told.I have to drag it some lines down and then if values are intact in other columns the formula does auto-fill

  11. #11
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: formula appear only if condition is satisfied, otherwise empty cell

    Glad to helps you


    Also:

    Mark your post [SOLVED] if it has been answered satisfactorily.
    To do this, click EDIT in your original post, click GO ADVANCED and set the PREFIX. It helps everybody!

    If you are satisfied by any members response to your problem, please click the star icon *of their post to show your appreciation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1