How to Convert Weekday Name to Number in Excel?
Last Updated :
24 Jun, 2022
MS-Excel is a program that is part of the Microsoft Office suite. It’s a multi-row, multi-column electronic spreadsheet that’s used to organize data, visualize data, and do various calculations/operations. Each row and column comprise a cell, each sheet contains 1048576 rows and 16383 columns. Each cell has an address that is determined by the column name and row number, such as A1, D2, and so on. A cell reference is another name for this.
Dates can be converted and formatted in various ways. Sometimes we need weekdays to be in integer format and sometimes in string format. According to the use case, we will need to convert from string to number and number to string. We can use MATCH() or LOOKUP() worksheet functions for this purpose. We have to map each weekday to the number pattern we want. For example: if we want ‘Monday’ to be mapped to 1, ‘Tuesday’ to 2, and so on. We might also like to start the week with Sunday, then Sunday will be mapped or converted to 1, Monday to 2, and so on…
Using MATCH Function
In this approach, we use the MATCH function to convert weekday names to numbers in Excel. Let us discuss this with the help of the below example. In the below example column A contains weekday names and column B has the converted integers for each weekday. To do this task we use the MATCH() function. This function is used to get the relative position of the given element from a range of the cell.
Syntax:
MATCH (lookup_value, lookup_array, [match_type])
Where,
loopup_value = This is a mandatory argument. Lookup value The value for which you are looking.
lookup_array= This is a mandatory argument. Lookup array The array of data to be searched.
[match_type]= This is an optional argument. Match type The following values can be used: 1, 0, -1. 1 is the default value.
- 1 – The MATCH method looks for the greatest value less than or equal to Lookup value.
- 0 – The MATCH function will look for the first value that matches Lookup value exactly.
- -1 – The Match function will look for the least number greater or equal to Lookup value.
In the below example the match function takes the lookup value from the ‘A’ column, then an array of week names is passed in the lookup_array, and the lookup_value is checked in the lookup array. As the look-up array started from Monday, MATCH() function for Monday results in 1 and also because match_type is 0, which will look for the first value that matches the lookup value exactly. Finally, the weekdays are converted to numbers in column B of our spreadsheet. Let us discuss them step by step:
Step 1: All the weekday names are given in the A column of our excel sheet.
Step 2: In the match function, the lookup value is taken as A2, and the lookup array is given as {“Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”,”Sunday”}, match type is given as 0 as we need an exact match.
Step 3: After using the formula, in the B2 cell we get the weekday number as 1 for the weekday ‘Monday’.
Step 4: By dragging the cell, we get converted/ matched values(Numbers) for all the weekday names of column A in column B.
Here as the lookup_array started from “Sunday”, Sunday is converted to 1, and the rest follows.
Using LOOKUP Function
Instead of using the MATCH() function, we can also use the LOOKUP() function. This function is used to find a matching lookup either in a row or column range and return the corresponding value from another row or column range.
Syntax:
= LOOKUP (lookup_value, lookup_vector, [result_vector])
Where,
lookup_value: This is a mandatory argument. Lookup value ,A value in the lookup vector that you want to find.
lookup_vector: This is a mandatory argument. Lookup vector, A range in Excel that just has one row or column.
Result vector: This input is optional. A range in Excel that just has one row or column. Lookup vector must be the same size. The lookup function searches the lookup value range for a value and returns it from the same point in the result vector.
In this example, we use the LOOKUP() function. A1 is given as the lookup_value, and a lookup_vector is given which has all the weekdays and mappings. In column B we use this function to convert the weekday name to a number in the first cell and then we drag to apply the same function to all the cells. Using the match() function is a better approach. Let us discuss them step by step:
Step 1: Weekday names are given in column A of the excel sheet.
Step 2: The lookup function is applied on the b1 cell of the column, look up value is given as A1 and the lookup array is ,{“Friday”,5;”Monday”,1;”Saturday”,6;”Sunday”,7;”Thursday”,4;”Tues day”,2;”Wednesday”,3} .
Step 3: After using the function, the weekday name in cell A1 is changed to a weekday number in cell B1.
Step 4: We drag the cell, to apply the function to the whole column and the result is shown in column B.

Similar Reads
How to Convert Date to Numeric in R?
In this article, we will discuss how to convert date to numeric in R Programming Language. Method 1: Using as.numeric() This function is used to convert date into numeric Syntax: as.numeric(date) where the date is the input date. Example: C/C++ Code data = as.POSIXct("1/1/2021 1:05:00 AM",
2 min read
How to Convert Text to Date in Excel
Have you ever found yourself staring at a column of dates in Excel, only to realize theyâre formatted as text? It's a common problem that can hinder your data analysis and reporting tasks. Fortunately, converting text to date in Excel is straightforward. If you're looking to use the Text to Columns
5 min read
How to Convert Scientific Notation to Text or Number in Excel?
Microsoft Excel is a universal software tool that is used by companies throughout the world to store data/numbers in the form of a spreadsheet. Excel not only helps users to store the data into spreadsheets, but it also gives us the freedom to use multiple smart features to manipulate, organize and
5 min read
How To Get Day of Week Number in Moment.js?
Moment.js is a popular and open-source JavaScript library for validating, manipulating, and formatting dates. One common task is to determine the day of the week for a given date. This can be particularly useful in applications that need to perform actions based on the day of the week. In this artic
2 min read
How to Convert Exponential Large Number to Normal Integer in Excel?
Excel is powerful data visualization and data management tool which can be used to store, analyze, and create reports on large data. It is generally used by accounting professionals for the analysis of financial data but can be used by anyone to manage large data. Data is entered into the rows and c
2 min read
How to Sort by Number in Excel?
Excel is the world where you can organise your data. Organising data is a very big task especially when you are doing it on a large scale. In Excel, one can have around 17 million cells in one worksheet. So at this point, arranging the data in a systematic order is very important. If you are curious
2 min read
How to Get Week Numbers from Dates in R?
Week number is the number of weeks within a year or in a set period. It indicates that people of different countries and organizations may have other ways to account for the weeks however, the most popular one is the ISO 8601. In this standard. When it comes to the extraction of week numbers in R, t
3 min read
How to Count Words in Excel
Excel is a tool for storing, organizing, and visualizing a large volume of data. It uses a rectangular block known as a cell to store the data unit. This tool can be used to perform different tasks like creating graphs and analyzing trends, to get insights from the data. Data analysis can be perform
6 min read
How to Convert Data from Wide to Long Format in Excel
Do you find your Excel data hard to analyze? Sometimes, changing the way your data is arranged can make it much easier to understand. Converting data from wide format to long format can help you organize your spreadsheet better, making it simpler to spot trends and patterns. This method is useful fo
3 min read
How to Round Date to Previous or Next Specific Weekday in Excel?
The WEEKDAY function produces a number between 1 and 7 that corresponds to specific days of the week. WEEKDAY, by default, assumes a Sunday-based week and allocates 1 to Monday, 2 to Tuesday, etc., with 7 given to Sunday. In order to retrieve the prior weekday occurring before a given date in Excel,
4 min read