Forum Discussion

a68tbird's avatar
a68tbird
Resolver II
8 years ago
Solved

Replace Values in Headers

Hello All,

  I'm creating a function that will cleanse and model a monthly invoice that we receive. The problem with this invoice is that some months the headers have underscores between the words (ie. Order_Number, Date_Created), but other months the underscore is not used. I'd like to remove the underscores the way that one might use Replace Values. I tried transposing the data so that I had all of the headers in one column, used the Replace Values function

 

= Table.ReplaceValue(#"Transposed Table","_"," ",Replacer.ReplaceValue,{"Column1"})

 but nothing happened! It didn't remove any of the underscores. I tried a longer string of characters (one that is absolutely in that column) and it just doesn't work. 

 

Any suggestions?

Thanks

  • Anonymous's avatar
    Anonymous
    8 years ago

    a68tbird,

    Change your code to the following:

    = Table.ReplaceValue(#"Transposed Table","_"," ",Replacer.ReplaceText,{"Column1"})


    There is an example for your reference.


    Regards,
    Lydia

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    a68tbird,

    Change your code to the following:

    = Table.ReplaceValue(#"Transposed Table","_"," ",Replacer.ReplaceText,{"Column1"})


    There is an example for your reference.


    Regards,
    Lydia

  • I believe I may know what's going on...I was sure that Replace Values could interpret "contains text" instead of an exact match. Nothing is being replaced because no cells are exactly "_".  So, how can I replace where value contains an underscore?