Home >Common Problem >How to enter text and formulas into cells in Microsoft Excel
Adding formulas to cells in Excel is easy. Adding text is even easier. But how to add text and formula at the same time in one cell? Tried and failed? Well, not anymore, when Geek Page is here to help you.
In this article, we will detail how to easily add both text and formulas to a cell in an Excel worksheet with the help of multiple examples. You can make your content dynamic, so your various requirements for this can be easily fulfilled by following the steps detailed in our article. Hope you like it!
Suppose you have the following Excel table, which contains the Length column and the Width column. You need to fill the
This is just a sample scenario. By following the solution detailed here, you can include any text and any formula in the cells of your Excel worksheet.
Step 1: First, enter a = symbol. Then, if you are typing text, enclose it in double quotes. To connect a formula to it, or add a variable in between, or add any dynamics, use the Connectionoperator&.
For example, in the example scenario mentioned in this article, you would place the rectangular text area first. So you need to double click on your cell and write the content as = "The rectangular area is". We enclose this part in double quotes because it is a text.
Now we need to calculate the area and append it to the text. So, put the concatenation operator & next. Then write the formula PRODUCT(A2, B2). PRODUCT formula will calculate the product of the given 2 cell values.
So, for this particular case, your final cell content will look like this.
="矩形的面积是" & PRODUCT(A2,B2)
Note: Dynamic means something that changes its value. For example, Area varies based on length and width. Dynamic content does not have double quotes. Static means something that does not change its value. For example, text content is static and should be enclosed in double quotes.
Step 2: After formatting all the cell contents, press Enter, you can see the area of the rectangle Calculated correctly and value replaced successfully.
Step 3: You can click on the cell and then click and drag the cell down in the lower right corner of the cell to apply the same formula and text to all cells in the same column.
Step 4 : Below is a screenshot showing how the formula is applied to the entire column .
Step 5: Now let’s make your cells more dynamic. Suppose you want the text in cell to be formatted as a rectangular area with Length =
="Length= " & A2 & " 和 Width = " & B2 & " 的矩形区域是 " & PRODUCT(A2,B2)
Explanation
Follow the above steps and you can form any dynamic content inside the cell, it’s that simple. Just remember one golden rule. All dynamic need to be connected using & characters without double quotes, and all static ones need to be placed within double quotes.
Step 6: If you press the Enter key, you can see that all values are dynamically replaced, you can also Drag the same format to all cells in the same column as described in step 3.
The above is the detailed content of How to enter text and formulas into cells in Microsoft Excel. For more information, please follow other related articles on the PHP Chinese website!