简体   繁体   中英

Remove everything before specific character if found in Excel

I want to remove everything before the colon, so that only the names are left. My current formula does that but it puts a #!Value error if there is no colon. It should change nothing and just copy the exact name if no ":" is present.

Column C

        key1:john
        key1:mike
        key1:edmund
        hello
        key3:edmund

etc

My formula =IFERROR(RIGHT(C1,LEN(C1)-FIND(":",C1)),"")

Column D

        john
        mike
        edmund
       #!Value
        edmund

etc

Your formula nearly does it, with just this one change:

=IFERROR(RIGHT(C1,LEN(C1)-FIND(":",C1)), C1) 
                                          ^----- replaced "" with C1 

This formula gives the results:

john
mike
edmund
hello
edmund

考虑:

=IF(ISERROR(FIND(":",A1)),A1,MID(A1,FIND(":",A1)+1,9999))

这是我对问题的解决方案:

=IF(ISNUMBER(SEARCH(":",C1)),RIGHT(C1,LEN(C1)-FIND(":",C1)),C1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM