Check if date is in sequencial order in all sheets

AriannaVV

New Member
Joined
Aug 6, 2017
Messages
34
Office Version
  1. 365
Platform
  1. Windows
Hi all.
I have a workbook with 31 sheets. In each sheet I have a title like: Line 364 _ Central Park, Beach, Monday 01.08.2023. The format is dd.mm.yyyy. The date changes sequencial for each sheet. Let's say if the first sheet is ...Monday 01.08.2023 next sheet is Tuesday 02.08.2023. I need to check if the dates in all sheets are in sequencial order and there is no error in them (like different month for example "01.07.2023"). If there is an error the code should stop and a pop up message tell the sheet where the error is.

Can someone help please?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If you want to exclude some sheets you can put an extra filter around the all_sheets array.

Here it is working as intended though
 
Upvote 0
Seems to work ok in a workbook with specific sheets. As the previous formula did, before the name option. If I add new sheets it can't calculate them and returns #VALUE error. If I delete them it works again. This is not what I need though. Nevermind thanks for your time anyway. Maybe a vba could do the job. Thanks for your effort!
 
Upvote 0
Yes if you add new sheets without that header and valid date in F3, it will fail. Could be worked around. But can you post a dropbox link or something?
 
Upvote 0
Excel Formula:
=LET(r;DROP(REDUCE("";all_sheets;LAMBDA(a;b;VSTACK(a;INDIRECT("'"&b&"'!F3"))));1);z;FILTER(--RIGHT(r;10);ISNUMBER(--RIGHT(r;10)));MAX(z-VSTACK(TAKE(z;1)-1;DROP(z;-1)))=1)
 
Upvote 0
Excel Formula:
=LET(r;DROP(REDUCE("";all_sheets;LAMBDA(a;b;VSTACK(a;INDIRECT("'"&b&"'!F3"))));1);z;FILTER(--RIGHT(r;10);ISNUMBER(--RIGHT(r;10)));MAX(z-VSTACK(TAKE(z;1)-1;DROP(z;-1)))=1)
That works perfect and excludes the unwanted sheet. I think we are close to finalize this. Now there is one more issue. When I add sheets, if i accidentaly bring the same date as previous, let's say : sheet 11 exists in the workbook with date value 11/08/2023, if I add sheet 12 with same date value 11/08/2023 does not return a FALSE. It remains TRUE wich is not correct, cause it's wrong to me if two sheets have the same date on header. On the contrary it works fine if the error is in month, that is in case of 11/07 instead of 11/08 it returns a FALSE as it should be. Any ideas why this happens?
 
Upvote 0
Yes I know why, but probably tomorrow I can look again
 
Upvote 0
Hi, try this

Excel Formula:
=LET(r;DROP(REDUCE("";all_sheets;LAMBDA(a;b;VSTACK(a;INDIRECT("'"&b&"'!F3"))));1);s;--RIGHT(r;10);z;FILTER(s;ISNUMBER(s));SUM(--(z-VSTACK(TAKE(z;1)-1;DROP(z;-1))<>1))=0)
 
Upvote 1
Solution

Forum statistics

Threads
1,215,375
Messages
6,124,589
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top