اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

السلام عليكم ورحمة الله وبركاته 

تحية طيبة 

اساتذة ارجو المساعده لو فرضنه عندي اي جملة او كلمات على سبيل المثال ( اوفيسنا) موجود في خلية A1 اريد عدد حرف ( أ ) يطلعلي نتيجة 2 وهكذا كل ما اغير الحرف يحصالي شكرا لكم جميعا 

قام بنشر

Put your string in cell A1 then run the following code that will list all the characters and their count in column C and D

Sub Count_All_Characters()
    Dim ch, arrKeys, arrValues, ws As Worksheet, dict As Object, txt As String, i As Long
    Set ws = ActiveSheet
    Set dict = CreateObject("Scripting.Dictionary")
    txt = ws.Range("A1").Value
    For i = 1 To Len(txt)
        ch = Mid(txt, i, 1)
        dict(ch) = dict(ch) + 1
    Next i
    With ws
        .Columns("C:D").ClearContents
        .Range("C1:D1").Value = Array("Character", "Count")
        If dict.Count > 0 Then
            arrKeys = dict.Keys
            arrValues = dict.Items
            .Range("C2").Resize(dict.Count, 1).Value = Application.Transpose(arrKeys)
            .Range("D2").Resize(dict.Count, 1).Value = Application.Transpose(arrValues)
        End If
    End With
    Set dict = Nothing
    MsgBox "Done", 64
End Sub

 

  • Like 1
  • Thanks 2
قام بنشر

وعليكم السلام ورحمة الله وبركاته

اظافة الى ما تفضل به استاذنا   lionheart 

اضيف حل بالمعادلات

اكنب الحرف المراد احصائه في الخلية D1

=LEN(A1)-LEN(SUBSTITUTE(A1;$D$1;""))

مثال

عد الاحرف.xlsx

  • Like 1
  • Thanks 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information