The short answer: Excel formulas have no dot operator
Excel’s worksheet formulas do not have a dot operator. You will not find a . that reaches into a value’s parts the way the dot does in C++. The dot does appear in Excel in a few other places, covered below.
Where the dot does appear: decimal points and names
- Decimal points. In many English-language settings, the dot is the decimal separator, so
=2.5*4returns 10. Some regions use a comma instead, so the same number is typed as2,5. - Names. Excel defined names can include periods, so a name such as
Sales.Totalis allowed. The period is just part of the name. It is not an operator.
The dot in VBA: reaching into objects
The dot becomes a real operator in VBA, the programming language built into Excel. In VBA, it reaches an object’s properties and methods:
Sub ShowValue()
Range("A1").Value = 10
MsgBox Range("A1").Value
End Sub
Range("A1") returns an object that represents a cell, and .Value is one of its properties. The first line sets the cell’s value to 10, and MsgBox shows it. Methods use the same dot. For example, Range("A1").ClearContents clears the cell’s contents.
How this compares with the dot in C++
The idea is the same in both: the dot connects an object to something that belongs to it. In C++, p.x reaches the member x of an object p. In VBA, Range("A1").Value reaches the Value property of a range object. The difference is that worksheet formulas do not use the dot this way, and VBA is a separate language from C++. For the C++ version, see The Dot Operator in C++.
The operators Excel formulas do use
If you were looking for the operators you can use in a worksheet formula, the main ones are:
- Arithmetic:
+,-,*,/,^(power) and%(percent, so=50%is 0.5). - Text:
&joins two pieces of text, so="Hi " & "there"returns Hi there. - Comparison:
=,<>(not equal),<,>,<=and>=.
For more on the arithmetic group, see What Are Arithmetic Operators?
Key points to remember
- Excel’s worksheet formulas do not have a dot operator.
- In Excel, the dot is a decimal point in numbers, and it can be part of a defined name.
- In VBA, the dot reaches an object’s properties and methods, such as
Range("A1").Value. - The idea is close to the dot in C++, but the two work in separate languages.