In this article, we will learn to generate random text values in Excel.
For this article we will be needing the use of the following functions:
The following are the description & syntax for the functions used in the formula:
The CHOOSE function takes values and returns the value corresponding to a particular index_num.
The MONTH function takes a valid excel date as an argument and returns the month number (1-12) of the date.
As we know, the MONTH function returns a number between the 1 to 12 numbers (months of the calender year). The CHOOSE function will take that number and return the value corresponding to the number.
Use the formula:
= CHOOSE ( MONTH ( date ) , "value1" , "value2" , "value3" ) |
Explanation:
Let's test this formula via running it on an example
Here is our list of dates in Values column A2:A10.
Here we have given the quarter year sub section in the snapshot above. We need to find the quarter period of the date in Values using the formula shown below.
Use the formula:
= CHOOSE ( MONTH (A2) , 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 4 , 4 , 4 ) |
Explanation:
As you can see the function returns 1 means first quarter of the year.
Here is the data that is provided as cell reference to the function. Now copy the formula to other cells using the Ctrl + D shortcut key or use the drag down option in Excel.
As you can see in the above snapshot the outcomes of the formula.
You can get the outcome with text like Q3 (year). Use the formula shown below.
Use the formula:
= "Q" & CHOOSE ( MONTH (A2) , 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 4 , 4 , 4 ) & " (" & YEAR(A2) & ")" |
As you can see from the above snapshot the customized format for the outcomes.
Below are some of the observational outcomes of the formula.
Notes :
Hope this article about how to generate random text values in Excel is explanatory. Find more articles on TEXT functions here. Please share your query below in the comment box. We will assist you.
Related Articles
How to use the CHOOSE Function in Excel
How to use the MONTH Function in Excel
Ignore zero in the Average of numbers
Popular Articles
50 Excel Shortcut to Increase Your Productivity
If with conditional formatting
Convert Inches To Feet and Inches in Excel 2016
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.