DONUT PROJECT 2015 - How To Create Partially Anonymous Data - Como Manter Informações parcialmente Anônimas

DONUT PROJECT 2015 - How To Create Partially Anonymous Data - Como Manter Informações parcialmente Anônimas


Às vezes é importante tornar as informações contidas em relatórios e dashboards parcialmente anônimas, mantendo certa confidencialidade e discrição de olhos sem autorização para consulta.

 Série eBook Donut Projects: 

DONUT PROJECT: VBA - Projetos e Códigos de Visual Basic for Applications (Visual Basic For Apllication)eBook - DONUT PROJECT 2024 - Volume 03 - Funções Financeiras - André Luiz Bernardes eBook - DONUT PROJECT 2024 - Volume 02 - Conectando Banco de Dados - André Luiz Bernardes eBook - DONUT PROJECT 2024 - Volume 01 - André Luiz Bernardes




O código abaixo permite-nos aplicar tal restrição:

Sub AnonymizeText()

'PURPOSE: Anonymize a number or text so only certain amount of original characters are showing (used alot with credit card #s)



Dim ShowChars As Integer

Dim AnonymChar As String

Dim SymbolString As String

Dim StringLength As Long

Dim AnonymEnd As Boolean

Dim cell As Range

Dim rng As Range



'Do you want to anonymize begining or end of text (TRUE for end, FALSE for beginning)

  AnonymEnd = False



'Number of characters you want to show

  ShowChars = 4



'Symbol you want to replace original characters

  AnonymChar = "*"



'Range where data is stored

  Set rng = Range("A2:A25")

  

'Loop through each cell and anonymize text

  For Each cell In rng.Cells

    

    StringLength = Len(cell.Value)

    SymbolString = Application.WorksheetFunction.Rept(AnonymChar, StringLength - ShowChars)

    

    If StringLength > ShowChars Then

      'Anonymize ending characters (ie 730*******)

        If AnonymEnd = True Then cell.Value = Left(cell.Value, ShowChars) & SymbolString

      

      'Anonymize beginning characters (ie *******540)

        If AnonymEnd = False Then cell.Value = SymbolString & Right(cell.Value, ShowChars)

     

    End If

  

  Next cell

End Sub


Olha como funciona:




Partially Anonymous String Formula Anonymize Microsoft Excel Data


Não me recordo de pessoalmente ter necessitado do código acima, mas imagino que poderia ser muito útil em áreas como Recursos Humanos, Auditoria, contas a pagar, folha de pagamento, e Tesouraria. Nestes departamentos os analistas geralmente utilizam dados que incluem números de conta, valores, e outras informações pessoais que provavelmente não devam ser mostrados fora do respectivo departamento.


Veja outros códigos:

VBA Excel | Extraindo a Data de uma Célula com Data e Horário - Remove Date from Date and Time VBA Excel | Converta Tudo para Maiúscula - Convert to Upper CaseVBA Excel | Contando Palavras na Planilha - Word Count from Entire Worksheet VBA Excel | Removendo Decimais dos Números - Remove Decimals from Numbers

VBA Excel |  Multiplique todos os Valores por um Número - Multiply all the Values by a Number VBA Excel | Calculando a Raiz Cúbica - Calculate the Cube Root

VBA Excel | Adicionando Letras de A até Z - Add A-Z Alphabets in a Range VBA Excel | Convertendo Numerais Romanos em Arábicos - Convert Roman Numbers into Arabic Numbers

VBA Excel | Converta todos os Números Negativos em Positivos - Remove Negative Signs VBA Excel | Preencha com zeros as Células em Branco - Replace Blank Cells with Zeros

Leia também:

eBook: Série DONUT PROJECT 2015: Projetos e Códigos de Visual Basic for Applications - Autor: André Luiz Bernardes  eBook: Série Top 10 Funções: Top 10 Funções VBA para o Microsoft Excel - Autor: André Luiz Bernardes

eBook: Série Funções Poderosas: 13 Funções Poderosas no MS Excel - Autor: André Luiz Bernardes  eBook: Série Visual Basic For Application: Criando Logs de acesso: Dicas e Códigos de Visual Basic for Applications - Autor: André Luiz Bernardes

eBook: Série VBA Tips: Rastrei seus Dashboards, Scorecards, Reports, Relatórios, Planilhas e Aplicações - Dicas e Códigos - Autor: André Luiz Bernardes  eBook: Série Data Science: Big Data, Como? - Autor: André Luiz Bernardes

eBook: Série Smarter Analytic: 5 Previsões de Big Data - Autor: André Luiz Bernardes


Conheça também:

DONUT PROJECT 2021 - VBA Function:  Como Rastrear o Google Maps (Coordenadas Geográficas) no VBA Excel?

DONUT PROJECT 2021 - VBA Function:  Crie Acrônimos a partir de Strings de Texto

DONUT PROJECT 2021 - VBA Function:  Convertendo uma Matrix num Vetor - Convert Matrix to a Vector

DONUT PROJECT 2021 - VBA Function:  Como tornar o Formulário Transparente no MS Excel?

DONUT PROJECT 2021 - VBA Function:  Faça Buscas no Google a Partir da Célula do MS Excel - Search Google From a Cell

DONUT PROJECT 2021 - VBA Function:  Decompondo um Nome nas Dimensões de uma Matriz

DONUT PROJECT 2021 - VBA Function: Extraindo o Último Sobrenome de um Nome Completo ou a Última Palavra de uma Frase

DONUT PROJECT 2021 - VBA Function:  Extraindo o Segundo Nome de um Nome Completo ou a Segunda Palavra de uma Frase

DONUT PROJECT 2021 - VBA Function: Extraindo o Primeiro Nome ou  a Primeira Palavra de uma Frase

Série Piece of Cake

Séries Donut


Comente e compartilhe este artigo!


brazilsalesforceeffectiveness@gmail.com

Nenhum comentário:

Postar um comentário

diHITT - Notícias