Skip to Main Content
Libraries
askus Ask us
 

Collection Management Services

Information on Collection Management Services and Operations

Excel

Remove punctuation, spaces

 

For Copy and paste:

=StripAccent(LOWER(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(L2,"("," "),")"," "),"-"," "),":"," "),";"," "),"!"," "),","," "),"?"," "),"["," "),"/"," "),"]"," "),"."," "))))
=LOWER(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"("," "),")"," "),"-"," "),":"," "),";"," "),"!"," "),","," "),"?"," "),"["," "),"]"," "),"."," ")))

For reading and editing:

=
StripAccent(

LOWER(
TRIM(
SUBSTITUTE(

SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(

SUBSTITUTE(

SUBSTITUTE(

SUBSTITUTE(
A1,
"("," "),
")"," "),
"-"," "),
":"," "),
";"," "),
"!"," "),
","," "),

"?"," "),

"["," "),

"/"," "),

"]"," "),
"."," "))))

Use on Alma Title and Publication Place

Strip Diacritics

Use this to replace diacritics with non-diacritic character

View Code > Insert > Module > copy and paste:

Function StripAccent(thestring As String)
Dim A As String * 1
Dim B As String * 1
Dim i As Integer
Const AccChars = "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ"
Const RegChars = "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy"
For i = 1 To Len(AccChars)
A = Mid(AccChars, i, 1)
B = Mid(RegChars, i, 1)
thestring = Replace(thestring, A, B)
Next
StripAccent = thestring
End Function

 

Alt+Q to close VBA

To use, enter formula =StripAccent(A2)

Count Unique Text

=COUNTA(UNIQUE(A2:A10))

To remove "The " or  "a " at the beginning of a title

first make a helper column to identify which ones have the word you want to remove

=IF(LEFT($F3, 2) = "a ", "Remove", "Keep")

Then filter and remove the number of characters you want

=IF($G3="Remove",RIGHT($F3, LEN($F3) - 2),$F3)
=IF(LEFT($F3, 4) = "the ", "Remove", "Keep")

Then filter and remove the number of characters you want

=IF($G3="Remove",RIGHT($F3, LEN($F3) - 4),$F3)

Use PowerQuery to remove Special Characters

To keep spaces while removing other special characters using Power Query in Excel, you can modify the Text.Select function to include spaces. Here's how you can do it:

  1. Select your data range.
  2. Go to the Data tab and select From Table/Range.
  3. In the Power Query Editor, select Add Column > Custom Column.
  4. Enter the following formula to keep only alphanumeric characters and spaces:
    Text.Select([ColumnName], {"A".."Z", "a".."z", "0".."9", " "})
    
  5. Click OK.
  6. Click Close & Load to return the cleaned data to Excel.

This formula will ensure that spaces are retained while removing other special characters

To create a column of clickable links to E-version:

=HYPERLINK(IF([@[Sheet1.MMS Id]]="","",CONCAT("https://search.library.uvic.ca/permalink/01VIC_INST/12198k2/alma",[@[Sheet1.MMS Id]])))

Creative Commons License
This work by The University of Victoria Libraries is licensed under a Creative Commons Attribution 4.0 International License unless otherwise indicated when material has been used from other sources.