Forum Discussion
searching for dates to trigger an action.
I am using a Mac with Microsoft 365. I have another question regarding using Excel.
My spreadsheet involves three columns and many rows. I am trying to design a formula to allow me to search Column B for any Year date between 1875 and 1895. My B column looks like the following :
| 22 Mar 1882 - East Randolph, Cattaraugus, New York, USA |
| 9 August 1931 - East Randolph, Cattaraugus County, New York, USA |
I want to search all rows in Column B to determine if they contain a year date between 1875 and 1895. If it does contain such a date I want to either conditionally format that row or move it to a different area of the sheet. Can this be done? I have tried IF, AND, FIND etc but I can't find a combo that will do this. AS yet there has been success. I am not sure if the dates read as text so I can't use the >or< to find the proper dates. John
|
19 Replies
- PeterBartholomew1Silver Contributor
Unsurprisingly, the best solution depends on the tools available. Given access to regular expressions (here I use Charles Williams's Fast Excel) the first 4-digit string, giving the year, may be extracted for each row and presented as a conditional format icon.
Alternatively, the condition may be used in a FILTER formula.
Avoiding the use of add-ins one could then have
- jhicks5charternetCopper ContributorPeter, Thank you for this information. These formulas look interesting but I do not know enough to know where to enter them. Could you elaborate more on the basics of how to enter these and were to enter these? Thanks John Hicks
- PeterBartholomew1Silver Contributor
Hi John
Not so mysterious really; they are 'ordinary' worksheet dynamic array formulas. Ordinary for me that is, others may not agree. The starting point is the defined name 'entry' that I applied to your data entry column, containing a list of dates and addresses. The function rgx.MID comes from a paid add-in so is shown for information but is of little relevance unless you have access to the add-in.
The formula contained in cell C3 generates 1 or 0 as a dynamic array depending on whether the date lies within the specified period or not. This is taken a step further in cell F3 when the function FILTER is applied to remove entries that do not lie within the specified period.
There are several challenges here. Getting the dates to be extracted from the text is one of them.
The file attached has one possible solution for that.
The bigger problem, though, is that the dates you want to work with are before 1990 and the Excel date numbering system starts on January 1, 1990. Any date before that is not recognized by Excel natively.
I did not work on a solution for that, but I found this article that may be a good starting point.
https://exceluser.com/1057/how-to-work-with-dates-before-1900-in-excel/
Power Query recognizes dates before 1990 and can handle the filtering aspect very easily.
Two challenges there: Power Query functionality in Excel for Mac is limited, and when you load your data into Excel you would have to convert those dates to text. But if all you care about is to find those dates, you can do that in Power Query and then have the results loaded as text into Excel.
I hope this helps.
- German_ChrisIron ContributorThe First Date in Excel is the 01.01.1900 Not 01.01.1990!!!!
- Correct! My typo above. Sorry for the confusion.
- jhicks5charternetCopper ContributorCelia, For various reasons I lost sight of this project and am now getting back to it. I know nothing of Power Query but when I try to get to it I am told that I must go to settings and download the ODBC Driver Manager and set up the database driver. I do not know where to find this . Its it actually another program? Since I am on Office 365 and a Mac, I am not sure sometimes that the directions apply to me or I am just not understanding. John Hicks
- Sorry, I cannot help with Excel for Mac.