How can I combine multiple nested Substitute functions in Excel?

后端 未结 5 1814
Happy的楠姐
Happy的楠姐 2021-01-17 08:35

I am trying to set up a function to reformat a string that will later be concatenated. An example string would look like this:

Standard_H2_W1_Launch_123x456_         


        
5条回答
  •  北恋
    北恋 (楼主)
    2021-01-17 09:21

    Thanks for the idea of breaking down a formula Werner!

    Using Alt+Enter allows one to put each bit of a complex substitute formula on separate lines: they become easier to follow and automatically line themselves up when Enter is pressed.

    Just make sure you have enough end statements to match the number of substitute( lines either side of the cell reference.

    As in this example:

    =
    substitute(
    substitute(
    substitute(
    substitute(
    B11
    ,"(","")
    ,")","")
    ,"[","")
    ,"]","")
    

    becomes:

    =
    SUBSTITUTE(
    SUBSTITUTE(
    SUBSTITUTE(
    SUBSTITUTE(B12,"(",""),")",""),"[",""),"]","")
    

    which works fine as is, but one can always delete the extra paragraphs manually:

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B12,"(",""),")",""),"[",""),"]","")
    

    Name > substitute()

    [American Samoa] > American Samoa

提交回复
热议问题