You are on page 1of 1

Cc cng thc Excel cn dng

1. Ct chui k t cn dng trc n c chung 1 c im VD: Ct chui

nthaidanguy@moet.edu.vn nthaidanguy@moet.gov.vn
Ly sau du ta dng cng thc sau: =IF(ISERR(FIND(",",D49)),RIGHT(D49,LEN(D49)-FIND("(",D49)),RIGHT(D49,LEN(D49)FIND(",",D49))) D49: cha chui cn ct. Kt qu: 2. Hm tch s ra khi 1 chui
Function ExtractNumber(rCell As Range) Dim lCount As Long Dim sText As String Dim lNum As String sText = rCell For lCount = Len(sText) To 1 Step -1 If IsNumeric(Mid(sText, lCount, 1)) Then lNum = Mid(sText, lCount, 1) & lNum End If Next lCount ExtractNumber = CLng(lNum) End Function

Vo excel, chn Alt F11, hin bng Visual Basic, Alt I (Insert) Modul General Copy code. Xong