Forum Discussion

pkogels_acsi_eu's avatar
pkogels_acsi_eu
Copper Contributor
May 24, 2020
Solved

Detect cell notation with formula or Power Query

Hi, In a sheet with booking information, the columns with amounts a formatted with special notations, indicating the currency of the amount. In the cell itself, only the value is stored. On screen,...
  • Subodh_Tiwari_sktneer's avatar
    Subodh_Tiwari_sktneer
    May 25, 2020

    pkogels_acsi_eu 

    No problem! Please replace the UDF with the following one.

     

    Function getCurrencySymbol(AmtCell As Range) As String
    Dim Matches As Object
    
    With CreateObject("VBScript.RegExp")
        .Global = False
        .Pattern = "General ""([A-Z]{3})"""
        
        If .test(AmtCell.NumberFormat) Then
            Set Matches = .Execute(AmtCell.NumberFormat)
            getCurrencySymbol = Matches(0).SubMatches(0)
        Else
            getCurrencySymbol = "EUR"
        End If
    End With
    End Function

     

    If that takes care of your question, please accept the post with the proposed solution as a Best Response to mark your question as Solved.

     

     

     

Resources