Match 2 sets of numbers in 2 cells

Saher Naji

Board Regular
Joined
Dec 19, 2019
Messages
76
Office Version
  1. 2013
Platform
  1. Windows
I want to generate a special excel formula. My wish is to find out the last working day of each week. Thus, the formula is designed to analyze consecutive dates and find all Fridays, or, if there is no Friday for a given week, the last working day in the same week before Friday. The Friday or the nearest working day of a given week before Friday is marked with the symbol 1, other dates this week without the symbol ("") or a blank cell. See the attached screenshot for prepared results column. Note that sometimes there are several rows with the same date (red dates) and actually this is the problem which faced me. So, the job result is an excel formula to mark such days with symbol 1.

1585903992156.png
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try this formula =IF(OR(WEEKDAY(A1)<=WEEKDAY(A2),A1-A2>=7),1,"")

The logic is that the weekday number increases during the week Sun=1, Mon=2 etc. If the next date (A1) has a weekday number less than the current date (A2) then that means the next date is in next week and the current date is the end of this week. Also, if there are 7 days or more between dates then the current date is the end of this week.
 
Upvote 0
I'm thinking....
Book1
ABCDEFG
1FormulaResultDay
219/12/201911Thursday51
312/12/201911Thursday50
411/12/2019 Wednesday50
509/12/2019 Monday50
606/12/201911Friday49
703/12/2019 Tuesday49
802/12/2019 Monday49
926/11/201911Tuesday48
1020/11/201911Wednesday47
1118/11/2019 Monday47
1213/11/201911Wednesday46
1311/11/2019 Monday46
1407/11/201911Thursday45
1524/10/201911Thursday43
1622/10/2019 Tuesday43
1721/10/2019 Monday43
1817/10/201911Thursday42
1915/10/2019 Tuesday42
2011/10/201911Friday41
2110/10/2019 Thursday41
2209/10/2019 Wednesday41
2303/10/201911Thursday40
2403/10/201911Thursday40
2501/10/2019 Tuesday40
2626/09/201911Thursday39
2723/09/2019 Monday39
2817/09/201911Tuesday38
2913/09/201911Friday37
3012/09/2019 Thursday37
Sheet5
Cell Formulas
RangeFormula
C2:C30C2=IF(A2="","",IF(WEEKNUM(A2)<>WEEKNUM(A1),1,IF(A2=A1,C1,"")))


Hope that helps.
 
Upvote 0
I'm thinking....
Book1
ABCDEFG
1FormulaResultDay
219/12/201911Thursday51
312/12/201911Thursday50
411/12/2019 Wednesday50
509/12/2019 Monday50
606/12/201911Friday49
703/12/2019 Tuesday49
802/12/2019 Monday49
926/11/201911Tuesday48
1020/11/201911Wednesday47
1118/11/2019 Monday47
1213/11/201911Wednesday46
1311/11/2019 Monday46
1407/11/201911Thursday45
1524/10/201911Thursday43
1622/10/2019 Tuesday43
1721/10/2019 Monday43
1817/10/201911Thursday42
1915/10/2019 Tuesday42
2011/10/201911Friday41
2110/10/2019 Thursday41
2209/10/2019 Wednesday41
2303/10/201911Thursday40
2403/10/201911Thursday40
2501/10/2019 Tuesday40
2626/09/201911Thursday39
2723/09/2019 Monday39
2817/09/201911Tuesday38
2913/09/201911Friday37
3012/09/2019 Thursday37
Sheet5
Cell Formulas
RangeFormula
C2:C30C2=IF(A2="","",IF(WEEKNUM(A2)<>WEEKNUM(A1),1,IF(A2=A1,C1,"")))


Hope that helps.
Thanks you very much,
Perfect 100%
Thanks Thanks ♥
 
Upvote 0
Try this formula =IF(OR(WEEKDAY(A1)<=WEEKDAY(A2),A1-A2>=7),1,"")

The logic is that the weekday number increases during the week Sun=1, Mon=2 etc. If the next date (A1) has a weekday number less than the current date (A2) then that means the next date is in next week and the current date is the end of this week. Also, if there are 7 days or more between dates then the current date is the end of this week.
thanks you very much,
I think we were on the right track, but there is a problem when we start a new year in the same list, but with Snakehips solutions it's working
thanks for all of you
Best Regards,
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,105
Members
453,021
Latest member
Justyna P

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