+ Reply to Thread
Results 1 to 20 of 20

Replace all 1's with 0's, and all 0's with 1's

  1. #1
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Replace all 1's with 0's, and all 0's with 1's

    Ok, so I would like to know if Exel has a function, that can replace, all 1's with 0's, and all 0's with 1's, at once.

  2. #2
    Registered User
    Join Date
    06-04-2018
    Location
    Europe
    MS-Off Ver
    Office365
    Posts
    78

    Re: Replace all 1's with 0's, and all 0's with 1's

    You can use Find and Replace (Ctrl + H)
    First Replace all 0's with - say 2
    Then replace all 1 to 0,
    then replace all 2 to 1

  3. #3
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    The problem is I have to do it at once. I have a formula with some references, like =C3+E3, and then I need Excel to replace the C with E, and then the E with C.

  4. #4
    Registered User
    Join Date
    06-04-2018
    Location
    Europe
    MS-Off Ver
    Office365
    Posts
    78

    Re: Replace all 1's with 0's, and all 0's with 1's

    Quote Originally Posted by thomexcel View Post
    The problem is I have to do it at once. I have a formula with some references, like =C3+E3, and then I need Excel to replace the C with E, and then the E with C.
    I do not understand.
    Say =C3+E3
    and then I need Excel to replace the C with E
    this mean? = E3+E3 ???
    and then the E with C
    this mean? = C3+C3 ???

    Please tell us from the beginning what you want, not after receiving an answer, that you actually want something else.

  5. #5
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    The idea I had before in the other thread, is not the same as this. What I need to do is I want to for example have Excel to change a formula, called

    =IF(Matches!$D$3='Group Point Counter'!$C$3,Matches!$E$3,)+IF(Matches!$D$4='Group Point Counter'!$C$3,Matches!$E$4,)+IF(Matches!$D$5='Group Point Counter'!$C$3,Matches!$E$5,)+IF(Matches!$D$6='Group Point Counter'!$C$3,Matches!$E$6,)+IF(Matches!$D$7='Group Point Counter'!$C$3,Matches!$E$7,)+IF(Matches!$D$8='Group Point Counter'!$C$3,Matches!$E$8,)+IF(Matches!$D$9='Group Point Counter'!$C$3,Matches!$E$9,)+IF(Matches!$D$10='Group Point Counter'!$C$3,Matches!$E$10,)+IF(Matches!$D$11='Group Point Counter'!$C$3,Matches!$E$11,)+IF(Matches!$D$12='Group Point Counter'!$C$3,Matches!$E$12,)+IF(Matches!$D$13='Group Point Counter'!$C$3,Matches!$E$13,)+IF(Matches!$D$14='Group Point Counter'!$C$3,Matches!$E$14,)+IF(Matches!$D$15='Group Point Counter'!$C$3,Matches!$E$15,)+IF(Matches!$D$16='Group Point Counter'!$C$3,Matches!$E$16,)+IF(Matches!$D$17='Group Point Counter'!$C$3,Matches!$E$17,)+IF(Matches!$D$18='Group Point Counter'!$C$3,Matches!$E$18,)+IF(Matches!$D$19='Group Point Counter'!$C$3,Matches!$E$19,)+IF(Matches!$D$20='Group Point Counter'!$C$3,Matches!$E$20,)+IF(Matches!$D$21='Group Point Counter'!$C$3,Matches!$E$21,)+IF(Matches!$D$22='Group Point Counter'!$C$3,Matches!$E$22,)+IF(Matches!$D$23='Group Point Counter'!$C$3,Matches!$E$23,)+IF(Matches!$D$24='Group Point Counter'!$C$3,Matches!$E$24,)+IF(Matches!$D$25='Group Point Counter'!$C$3,Matches!$E$25,)+IF(Matches!$D$26='Group Point Counter'!$C$3,Matches!$E$26,)+IF(Matches!$D$27='Group Point Counter'!$C$3,Matches!$E$27,)+IF(Matches!$D$28='Group Point Counter'!$C$3,Matches!$E$28,)+IF(Matches!$D$29='Group Point Counter'!$C$3,Matches!$E$29,)+IF(Matches!$D$30='Group Point Counter'!$C$3,Matches!$E$30,)+IF(Matches!$D$31='Group Point Counter'!$C$3,Matches!$E$31,)+IF(Matches!$D$32='Group Point Counter'!$C$3,Matches!$E$32,)+IF(Matches!$D$33='Group Point Counter'!$C$3,Matches!$E$33,)+IF(Matches!$D$34='Group Point Counter'!$C$3,Matches!$E$34,), and I need to change all E's to D's, and all D's, to E's, and I have like 20 of those formula, where I have to replace D's with E's, and E's with D's.

  6. #6
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Replace all 1's with 0's, and all 0's with 1's

    i think you need to upload a file with examples that cover the full range of your requirements.

    Also consider can you use VBA or do you need a manual method.

    otherwise if i understand your latest post correctly - you can do it in a 3 step process as per his example - just replace
    $C$ with $F$
    then $E$ with $C$
    and $F$ with $E$

    if it is just swapping C and E's
    Last edited by scottiex; 06-28-2018 at 06:22 PM.
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  7. #7
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    Quote Originally Posted by scottiex View Post
    i think you need to upload a file with examples that cover the full range of your requirements.

    Also consider can you use VBA or do you need a manual method.
    Okay I can upload a sample, but it may be a confusing excel, but thank you for helping me . And I can use VBA's.

    The reason I have to replace them, is that I have one formula that counts the Goals For, but I need one that counts, the Goals Against
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    Quote Originally Posted by scottiex View Post
    i think you need to upload a file with examples that cover the full range of your requirements.

    Also consider can you use VBA or do you need a manual method.

    otherwise if i understand your latest post correctly - you can do it in a 3 step process as per his example - just replace
    $C$ with $F$
    then $E$ with $C$
    and $F$ with $E$

    if it is just swapping C and E's
    Hey I think that works, thanks a lot . Thank you for trying to help me, even though I was bad explainer.

  9. #9
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    Sorry, again, but why does Excel say this formula equals False? =IF(Matches!$D$3='Group Point Counter'!$C$3,IF(Matches!$E$4>Matches!$G$4;1))
    Last edited by thomexcel; 06-28-2018 at 06:40 PM.

  10. #10
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Replace all 1's with 0's, and all 0's with 1's

    what is he HVIS function? Do you mean "If"?
    what cell do you see it in now?
    your formula seems to be mixing two different languages / formats.

  11. #11
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    Quote Originally Posted by scottiex View Post
    what is he HVIS function? Do you mean "If"?
    what cell do you see it in now?
    your formula seems to be mixing two different languages / formats.
    No, it's just because I change HVIS to IF, so it is in english here at the forum, I just forgot to do it with that one, but on my excel the formula is =HVIS(Matches!$D$3='Group Point Counter'!$C$3;HVIS(Matches!$E$4>Matches!$G$4;1). So I havent mixed languages in the formula

    It is not smileys I want to make.
    Last edited by thomexcel; 06-28-2018 at 06:45 PM.

  12. #12
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Replace all 1's with 0's, and all 0's with 1's

    IF(A=B,IF(C>D,1))

    so if A <>B and C not > D, then false.

    maybe you want something like

    Please Login or Register  to view this content.
    where 0 is your substitute for false.

  13. #13
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    Thanks for helping, but I dont understand this

    Quote Originally Posted by scottiex View Post

    so if A <>B

  14. #14
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Replace all 1's with 0's, and all 0's with 1's

    exactly.. so it doesnt go to the first option it goes to the second one that you have not supplied - hence false

    If statement format is
    if(check statement, if true, if false and if you dont enter this then just "false")

  15. #15
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    Quote Originally Posted by scottiex View Post
    IF(A=B,IF(C>D,1))

    so if A <>B and C not > D, then false.

    maybe you want something like

    Please Login or Register  to view this content.
    where 0 is your substitute for false.
    Thank you very much

  16. #16
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Replace all 1's with 0's, and all 0's with 1's

    OK mark the thread as solved and assign any * to anyone who helped.

    My second part of post #6 of course just rephrased what tommy90 was already telling you to do based on the new info

  17. #17
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Replace all 1's with 0's, and all 0's with 1's

    Your title says swap 0's and 1's, but in 1 post you refer to C's and E's , then provide a formula and say you want to swap D's and E's

    Can you explain exactly what you are doing, because I have a feeling there is a MUCH simpler way of doing what that beast of a formula in post #5 is doing.
    Maybe even this?
    =SUMIF(Matches!$D$3:$D$34,'Group Point Counter'!$C$3,Matches!$E$3:$E$34)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  18. #18
    Registered User
    Join Date
    04-16-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    2010
    Posts
    74

    Re: Replace all 1's with 0's, and all 0's with 1's

    Do you know why is Excel saying this is wrong? =IF(Matches!C3=H2H!D3(AND(Matches!G3=H2H!H3,Matches!D3),0,)

    It says that it is missing a right ) or left (

  19. #19
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Replace all 1's with 0's, and all 0's with 1's

    3 open brackets and only 2 close brackets.
    maybe you should explain in words what you want it to do.
    Last edited by scottiex; 06-29-2018 at 06:04 PM.

  20. #20
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Replace all 1's with 0's, and all 0's with 1's

    1. Again, can you explain what you are doing?
    2. Did you try my suggested formula
    3. Your formula is almost right...
    =IF(and(Matches!C3=H2H!D3,Matches!G3=H2H!H3),Matches!D3,0)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 02-27-2018, 11:22 AM
  2. REPLACE function help replace two separate texts Ctrl H
    By Uldis in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2015, 10:51 AM
  3. [SOLVED] find and replace to not replace characters found as wildcards
    By sabutler4 in forum Excel General
    Replies: 4
    Last Post: 07-03-2013, 06:48 PM
  4. Multiple Find and Replace to replace a list of strings
    By WalterP34 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-11-2011, 07:41 PM
  5. [SOLVED] find and replace - replace data in rows to separated by commas
    By msdker in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2006, 08:10 PM
  6. [SOLVED] Using Find and Replace to replace " in a macro
    By snail30152 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2006, 06:58 PM
  7. How can I use replace(alt+H) for mutiple items needing replace
    By Gery in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM

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