Forum Discussion
Calculated Column with Dates and "IF"
RJF61 You need to add the error you are receiving. I do get the gist of what you are trying to do so here is an example:
In SharePoint, you can use calculated columns to display data based on other columns in your list or library. To achieve your goal, you can create a calculated column with a formula that checks the "Created" field and returns the string "2022" or "2023" or "2024" based on the specified date ranges. Here's how you can do it:
1. Go to your SharePoint list or library.
2. Click on "Settings" (gear icon) and then select "List settings" or "Library settings" depending on what you have.
3. Under the Columns section, click on "Create column."
4. Give your column a name, like "Fiscal Year"
5. For the type of information in this column, choose "Calculated (calculation based on other columns)."
6. In the "Formula" box, enter the following formula:
=IF(AND(Created>DATE(2021,6,30),Created<DATE(2022,7,1)),"2022",IF(AND(Created>DATE(2022,6,30),Created<=DATE(2023,7,1)),"2023","2024"))
This formula checks if the "Created" date falls within the specified ranges and returns the appropriate string.
7. For "The data type returned from this formula is:", select "Single line of text."
8. Click "OK" to save the column.
Now, when items are added to your list or library, this new column will automatically display "2022" or "2023" based on when the item was created. If the creation date does not fall within the specified ranges, the column will be empty.
Please like and mark as best response if you found this helpful 🙂