Table of Contents
Example Scenario
Solution 1: Use the Format Cells option
解决方案 3:通过组合 CHOOSE 和 WEEKDAY 公式函数
公式说明
Home Common Problem How to extract date value from date value in Microsoft Excel

How to extract date value from date value in Microsoft Excel

May 02, 2023 pm 07:10 PM
Cell excel official

In some cases you may want to extract a date from a date. Let's say your date is 27/05/2022 and your Excel sheet should be able to tell you that today is Friday. If this could be achieved, it could find applications in many situations, such as finding workdays for items, school assignments, etc.

In this article, we have come up with 3 different solutions that you can use to easily extract date values ​​from date values ​​and automatically apply them to the entire column. Hope you enjoyed this article.

Example Scenario

We have a column named Date which contains date values. The other column Day is empty and its value will be filled by calculating the date value from the corresponding date value in the Date column.

Solution 1: Use the Format Cells option

This is the simplest of all methods as it does not involve any formulas.

Step 1: Copy the entire date value from column 1 (Date column).

You can select the entire data, right-click and select the "Copy" option, or you can select the data# After ## simply press the CTRL C key.

如何从 Microsoft Excel 中的日期值中提取日期值

Step 2: Next, click the th column of the column where you want to extract the Day value a cell.

如何从 Microsoft Excel 中的日期值中提取日期值

Step 3: Now press the CTRL V key to paste the data.

如何从 Microsoft Excel 中的日期值中提取日期值

Step 4:Right-click anywhere in the selected range of cells and click the button named "Settings" Cell" option.

如何从 Microsoft Excel 中的日期值中提取日期值

Step 5: In the "Set CellFormat" window, first click "Number"Tab. Next, under Category Options, click Customize Options.

Now, under the

Type field, enter ddd. Under the Sample section just above the Type field you will be able to view sample data. Because we gave ddd, the example data displays weekday in 3-letter format, which in the following example is Tue.

Click the

OK button after completion.

如何从 Microsoft Excel 中的日期值中提取日期值

If you wish to display full working days then you need to provide

dddd instead of under the Type field ddd. Makes the sample data displayed as Tuesday.

如何从 Microsoft Excel 中的日期值中提取日期值

Step 6: That’s it. You have successfully extracted a date value from a date value, it's that simple.

如何从 Microsoft Excel 中的日期值中提取日期值

Solution 2: Use the TEXT formula function

This is another simple method that you can use to quickly extract date values ​​from date values . This method uses a formula function called

Text().

Step 1:Double-clickthe first cell of the column where you want to extract the date value. Now, copy and paste the following formula onto it.

=TEXT(A3,"ddd")
Copy after login
You must

replace A3

with the desired cell ID that has the date value. Additionally, ddd will give the date in 3-letter format. For example, Tuesday.

如何从 Microsoft Excel 中的日期值中提取日期值 If you want a fully formatted date value, such as

Tuesday

, then your formula should have dddd as its first Two parameters instead of ddd.

如何从 Microsoft Excel 中的日期值中提取日期值

Step 2

: If you press elsewhere or press the Enter key, you can see that the formula has been successfully applied, And now the date value is extracted successfully.

如果您想在列中应用公式,只需单击并拖动单元格右下角小正方形

如何从 Microsoft Excel 中的日期值中提取日期值

第 3 步:您现在拥有 Excel 工作表中所有日期值的日期值。

如何从 Microsoft Excel 中的日期值中提取日期值

解决方案 3:通过组合 CHOOSE 和 WEEKDAY 公式函数

与本文中列出的前 2 种方法相比,此方法相对复杂。此方法通过结合 2 个公式函数即Choose()Weekday()从日期值中提取日期值。然而,这种方法有点令人讨厌,但我们喜欢令人讨厌的东西。希望你也这样做。

第 1 步双击Day 列的第一个单元格以编辑其内容。将以下公式复制并粘贴到其上。

=CHOOSE(WEEKDAY(A3),"SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY")
Copy after login

公式中的A3必须替换为具有要从中提取日期值的日期值的单元格的单元格 ID。

如何从 Microsoft Excel 中的日期值中提取日期值

公式说明

上面公式中首先解决的部分是WEEKDAY(A3)Weekday 函数将日期作为参数,并以整数形式返回工作日。默认情况下,该函数假定一周从星期日到星期六。所以,如果这是一个正常的场景,你可以只给这个函数一个参数。在这个公式中,我只给出了一个参数 A3,它是包含我需要从中查找日期的日期的单元格的单元格 ID。但是,如果您的一周从星期一开始,那么您需要为您的函数再提供一个参数,使其成为 WEEKDAY(A3,2)。因此,在这种情况下,您的最终公式将如下所示。

=CHOOSE(WEEKDAY(A3,2),"SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY")
Copy after login

因此WEEKDAY()函数以数字格式返回一周中的星期几。也就是说,如果这一天是Tuesday,那么WEEKDAY() 将返回 3

CHOOSE()函数根据其第一个参数从其参数列表中返回一个字符串。

CHOOSE()函数可以有很多参数。第一个参数是索引号。索引号后面的参数是需要根据索引号选取的字符串。例如,如果 CHOOSE() 函数的第一个参数是 1 ,那么 CHOOSE()函数返回列表中的第一个字符串。

所以在这个特定的场景中,WEEKDAY()函数返回3作为它的返回值。现在CHOOSE()函数将这个3作为它的第一个参数。并根据此索引值返回列表中的第三个字符串。所以CHOOSE()函数最终会返回TUESDAY

如果您想返回天的短格式,您可以在主公式中进行调整,如下所示。

=CHOOSE(WEEKDAY(A3,2),"Sun","Mon","Tue","Wed","Thu","Fri","Sat")
Copy after login

第 2 步:如果您按Enter键或单击其他任何位置,您可以看到日期值已成功填充到您选择的单元格中。

要将公式应用于列中的所有单元格,请单击单元格角落的小方形图标并将其向下拖动

如何从 Microsoft Excel 中的日期值中提取日期值

第 3 步:该公式现在已成功应用于所有单元格,并且现在将日期值填充到整个列中。

如何从 Microsoft Excel 中的日期值中提取日期值

The above is the detailed content of How to extract date value from date value in Microsoft Excel. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Excel found a problem with one or more formula references: How to fix it Excel found a problem with one or more formula references: How to fix it Apr 17, 2023 pm 06:58 PM

Use an Error Checking Tool One of the quickest ways to find errors with your Excel spreadsheet is to use an error checking tool. If the tool finds any errors, you can correct them and try saving the file again. However, the tool may not find all types of errors. If the error checking tool doesn't find any errors or fixing them doesn't solve the problem, then you need to try one of the other fixes below. To use the error checking tool in Excel: select the Formulas tab. Click the Error Checking tool. When an error is found, information about the cause of the error will appear in the tool. If it's not needed, fix the error or delete the formula causing the problem. In the Error Checking Tool, click Next to view the next error and repeat the process. When not

How to set the print area in Google Sheets? How to set the print area in Google Sheets? May 08, 2023 pm 01:28 PM

How to Set GoogleSheets Print Area in Print Preview Google Sheets allows you to print spreadsheets with three different print areas. You can choose to print the entire spreadsheet, including each individual worksheet you create. Alternatively, you can choose to print a single worksheet. Finally, you can only print a portion of the cells you select. This is the smallest print area you can create since you could theoretically select individual cells for printing. The easiest way to set it up is to use the built-in Google Sheets print preview menu. You can view this content using Google Sheets in a web browser on your PC, Mac, or Chromebook. To set up Google

How to embed a PDF document in an Excel worksheet How to embed a PDF document in an Excel worksheet May 28, 2023 am 09:17 AM

It is usually necessary to insert PDF documents into Excel worksheets. Just like a company's project list, we can instantly append text and character data to Excel cells. But what if you want to attach the solution design for a specific project to its corresponding data row? Well, people often stop and think. Sometimes thinking doesn't work either because the solution isn't simple. Dig deeper into this article to learn how to easily insert multiple PDF documents into an Excel worksheet, along with very specific rows of data. Example Scenario In the example shown in this article, we have a column called ProductCategory that lists a project name in each cell. Another column ProductSpeci

What should I do if there are too many different cell formats that cannot be copied? What should I do if there are too many different cell formats that cannot be copied? Mar 02, 2023 pm 02:46 PM

Solution to the problem that there are too many different cell formats that cannot be copied: 1. Open the EXCEL document, and then enter the content of different formats in several cells; 2. Find the "Format Painter" button in the upper left corner of the Excel page, and then click " "Format Painter" option; 3. Click the left mouse button to set the format to be consistent.

How to find and delete merged cells in Excel How to find and delete merged cells in Excel Apr 20, 2023 pm 11:52 PM

How to Find Merged Cells in Excel on Windows Before you can delete merged cells from your data, you need to find them all. It's easy to do this using Excel's Find and Replace tool. Find merged cells in Excel: Highlight the cells where you want to find merged cells. To select all cells, click in an empty space in the upper left corner of the spreadsheet or press Ctrl+A. Click the Home tab. Click the Find and Select icon. Select Find. Click the Options button. At the end of the FindWhat settings, click Format. Under the Alignment tab, click Merge Cells. It should contain a check mark rather than a line. Click OK to confirm the format

How to remove commas from numeric and text values ​​in Excel How to remove commas from numeric and text values ​​in Excel Apr 17, 2023 pm 09:01 PM

On numeric values, on text strings, using commas in the wrong places can really get annoying, even for the biggest Excel geeks. You may even know how to get rid of commas, but the method you know may be time-consuming for you. Well, no matter what your problem is, if it is related to a comma in the wrong place in your Excel worksheet, we can tell you one thing, all your problems will be solved today, right here! Dig deeper into this article to learn how to easily remove commas from numbers and text values ​​in the simplest steps possible. Hope you enjoy reading. Oh, and don’t forget to tell us which method catches your eye the most! Section 1: How to Remove Commas from Numerical Values ​​When a numerical value contains a comma, there are two possible situations:

How to prevent Excel from removing leading zeros How to prevent Excel from removing leading zeros Feb 29, 2024 am 10:00 AM

Is it frustrating to automatically remove leading zeros from Excel workbooks? When you enter a number into a cell, Excel often removes the leading zeros in front of the number. By default, it treats cell entries that lack explicit formatting as numeric values. Leading zeros are generally considered irrelevant in number formats and are therefore omitted. Additionally, leading zeros can cause problems in certain numerical operations. Therefore, zeros are automatically removed. This article will teach you how to retain leading zeros in Excel to ensure that the entered numeric data such as account numbers, zip codes, phone numbers, etc. are in the correct format. In Excel, how to allow numbers to have zeros in front of them? You can preserve leading zeros of numbers in an Excel workbook, there are several methods to choose from. You can set the cell by

How to create a custom power plan on Windows 11 How to create a custom power plan on Windows 11 Apr 28, 2023 am 11:34 AM

How to Create a Custom Power Plan on Windows 11 Custom power plans allow you to determine how Windows reacts to different situations. For example, if you want your monitor to turn off after a certain amount of time, but don't want it to go to sleep, you can create a custom schedule to do this. Create a custom power plan on Windows 11: Open the Start menu and type control panel. Select Control Panel from the search results. In Control Panel, change the View by option to Large icons. Next, select Power Options. Click the Create power plan option in the Power Options menu. Select the basic power plan you want to use from the options provided. Give it a descriptive name in the Plan Name field at the bottom