Use 'if' to check a condition. If condition is not met, then do not change the value in the cell. Keep the...












0















Cell B1 has value 1
Cell B2 has value 1



Cell B10 has no value.
I write 'if' formula: B10 = if(b2=b1, b2,)
The value in B10 changes to 1.



Now, I change B2 value to 2.
The cell B10 changes to 0. (because the 'if' conditon is not met).



But I want the if forumula to do nothing and keep the B10 value same as before, i.e. 1.
I do not want to change B10 value when 'if' condition is not met.



Please guide with the solution.










share|improve this question

























  • Just for grins try =if(B2=B1,B2,B10). Excel will probably spit it out, but maybe not.

    – Daniel R Hicks
    Oct 3 '13 at 12:16











  • When you write a formula in B10 you lose the value in that cell. I think you have to set the formula in another cell (eg C10 to have C10=(if(B2=B1;B2;B10))

    – Ale
    Oct 18 '13 at 7:57


















0















Cell B1 has value 1
Cell B2 has value 1



Cell B10 has no value.
I write 'if' formula: B10 = if(b2=b1, b2,)
The value in B10 changes to 1.



Now, I change B2 value to 2.
The cell B10 changes to 0. (because the 'if' conditon is not met).



But I want the if forumula to do nothing and keep the B10 value same as before, i.e. 1.
I do not want to change B10 value when 'if' condition is not met.



Please guide with the solution.










share|improve this question

























  • Just for grins try =if(B2=B1,B2,B10). Excel will probably spit it out, but maybe not.

    – Daniel R Hicks
    Oct 3 '13 at 12:16











  • When you write a formula in B10 you lose the value in that cell. I think you have to set the formula in another cell (eg C10 to have C10=(if(B2=B1;B2;B10))

    – Ale
    Oct 18 '13 at 7:57
















0












0








0








Cell B1 has value 1
Cell B2 has value 1



Cell B10 has no value.
I write 'if' formula: B10 = if(b2=b1, b2,)
The value in B10 changes to 1.



Now, I change B2 value to 2.
The cell B10 changes to 0. (because the 'if' conditon is not met).



But I want the if forumula to do nothing and keep the B10 value same as before, i.e. 1.
I do not want to change B10 value when 'if' condition is not met.



Please guide with the solution.










share|improve this question
















Cell B1 has value 1
Cell B2 has value 1



Cell B10 has no value.
I write 'if' formula: B10 = if(b2=b1, b2,)
The value in B10 changes to 1.



Now, I change B2 value to 2.
The cell B10 changes to 0. (because the 'if' conditon is not met).



But I want the if forumula to do nothing and keep the B10 value same as before, i.e. 1.
I do not want to change B10 value when 'if' condition is not met.



Please guide with the solution.







microsoft-excel worksheet-function






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 '16 at 2:38









fixer1234

18.8k144982




18.8k144982










asked Oct 3 '13 at 11:40









AshutoshAshutosh

111




111













  • Just for grins try =if(B2=B1,B2,B10). Excel will probably spit it out, but maybe not.

    – Daniel R Hicks
    Oct 3 '13 at 12:16











  • When you write a formula in B10 you lose the value in that cell. I think you have to set the formula in another cell (eg C10 to have C10=(if(B2=B1;B2;B10))

    – Ale
    Oct 18 '13 at 7:57





















  • Just for grins try =if(B2=B1,B2,B10). Excel will probably spit it out, but maybe not.

    – Daniel R Hicks
    Oct 3 '13 at 12:16











  • When you write a formula in B10 you lose the value in that cell. I think you have to set the formula in another cell (eg C10 to have C10=(if(B2=B1;B2;B10))

    – Ale
    Oct 18 '13 at 7:57



















Just for grins try =if(B2=B1,B2,B10). Excel will probably spit it out, but maybe not.

– Daniel R Hicks
Oct 3 '13 at 12:16





Just for grins try =if(B2=B1,B2,B10). Excel will probably spit it out, but maybe not.

– Daniel R Hicks
Oct 3 '13 at 12:16













When you write a formula in B10 you lose the value in that cell. I think you have to set the formula in another cell (eg C10 to have C10=(if(B2=B1;B2;B10))

– Ale
Oct 18 '13 at 7:57







When you write a formula in B10 you lose the value in that cell. I think you have to set the formula in another cell (eg C10 to have C10=(if(B2=B1;B2;B10))

– Ale
Oct 18 '13 at 7:57












1 Answer
1






active

oldest

votes


















0














After the second , in the IF statement you have to tell Excel what to do. If you want the B10 to be blank if the condition is not met, you will need to add " " to the statement after the second coma.



=IF(B2=B1, B2, "")


This will result in B10 remaining blank if B1 and B2 are not equal.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f653823%2fuse-if-to-check-a-condition-if-condition-is-not-met-then-do-not-change-the-v%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    After the second , in the IF statement you have to tell Excel what to do. If you want the B10 to be blank if the condition is not met, you will need to add " " to the statement after the second coma.



    =IF(B2=B1, B2, "")


    This will result in B10 remaining blank if B1 and B2 are not equal.






    share|improve this answer




























      0














      After the second , in the IF statement you have to tell Excel what to do. If you want the B10 to be blank if the condition is not met, you will need to add " " to the statement after the second coma.



      =IF(B2=B1, B2, "")


      This will result in B10 remaining blank if B1 and B2 are not equal.






      share|improve this answer


























        0












        0








        0







        After the second , in the IF statement you have to tell Excel what to do. If you want the B10 to be blank if the condition is not met, you will need to add " " to the statement after the second coma.



        =IF(B2=B1, B2, "")


        This will result in B10 remaining blank if B1 and B2 are not equal.






        share|improve this answer













        After the second , in the IF statement you have to tell Excel what to do. If you want the B10 to be blank if the condition is not met, you will need to add " " to the statement after the second coma.



        =IF(B2=B1, B2, "")


        This will result in B10 remaining blank if B1 and B2 are not equal.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 3 '13 at 11:51









        CharlieRBCharlieRB

        20.5k44491




        20.5k44491






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f653823%2fuse-if-to-check-a-condition-if-condition-is-not-met-then-do-not-change-the-v%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀