Using the following VBA code, you can count a character or a number, or even a string, within a range of data regions, several times, or several, in Excel.
The code below is the VBA macro code.
Set Myb = CreateObject ("Scripting.Dictionary"): Myb ("number") = "Times"
Set rng = Application.inputbox ("Select the area to be counted:", type:=8)
ActiveSheet.Cells.Interior.ColorIndex = 0
Rng. Interior.ColorIndex = 3
For each rng1 in RNG
Myb (rng1. Value) = Application.WorksheetFunction.CountIf (RNG, rng1)
Set rng3 = Application.inputbox ("Select result output:", type:=8)
. Resize (Myb. Count) = Application.transpose (Myb.keys)
. Offset (, 1). Resize (Myb. Count) = Application.transpose (Myb.items)
Set Myb = Nothing:set Rng3 = Nothing