How to run sequential functions in a single cell in excel

AusFastLife

New Member
Joined
Apr 28, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Dear All,

This isn't actually a question. Just a post to explain how to achieve an effect that I was looking for, but couldn't find an answer to. But then when I was writing out my question to ask for advice on this forum, I actually worked it out. So I thought I would post it any way incase anyone else is looking for this solution.

To explain I wanted to run multiple functions sequentially one after the other in a single cell. but I couldn't work out how to do it.

I have a spread sheet which lists meeting dates. I wanted to create a formula in one cell that states the ordinal day of the week a given date falls on for that month.

For example the date (in format dd/mm/yyyy) 23/01/2023 is the 4th Monday of that month. The date 13/12/2023 is the 2nd Wednesday of that Month.

I had the formula "=ROUNDUP(DAY(D16)/7,0)" [formula 1] that gives me the week of that particular month. that a given date falls on eg if the date 23/1/2023 is in cell D16 then this formula returns the value "4" since this date is in the 4th week of January.

The formula "=I16&IF(AND(MOD(ABS(I16),100)>10,MOD(ABS(I16),100)<14),"th",CHOOSE(MOD(ABS(I16),10)+1,"th","st","nd","rd","th","th","th","th","th","th"))" [formula 2] takes a number in a cell (in this example I have entered the number 1 in cell I16 and the formula returns the number "1st". If you change the number in cell I16 to 3 the formula returns the value "3rd" and so on.
Lastly I can pull the day of the week that the date falls on by referring to Cell E16

Please see the Mini-sheet below for the above described examples.

Reports and Compliance Dates.xlsx
BCDEFGHI
14EventMonthMeeting DateMeeting DayActual Date HeldComments
15
16Ordinary Board MeetingJanuary23/01/2023Monday4th Monday1st1
17Ordinary Board MeetingMarch20/03/2023Monday3rd Monday
18Extra-Ordinary Board Meeting - to discuss financeApril17/04/2023Monday3rd Monday
19Ordinary Board MeetingMay15/05/2023Monday3rd Monday
20Ordinary Board MeetingJuly17/07/2023Monday3rd Monday
21Extra-Ordinary Board Meeting - to discuss financeAugust21/08/2023Monday3rd Monday
2) Future Years
Cell Formulas
RangeFormula
C16:C21C16=D16
D16:D21D16=LET(Meet,'1) Theoretical'!D16,Yr,$C$11,n,INT((DAY(Meet)+6)/7),FOM,DATE(Yr,MONTH(Meet),1),Guess,FOM-WEEKDAY(FOM)+WEEKDAY(Meet)+n*7,nPrime,INT((Guess-FOM+7)/7),Guess+7*(n-nPrime))
E16:E21E16=TEXT(D16,"DDDD")
H16H16=I16&IF(AND(MOD(ABS(I16),100)>10,MOD(ABS(I16),100)<14),"th",CHOOSE(MOD(ABS(I16),10)+1,"th","st","nd","rd","th","th","th","th","th","th"))
G16:G21G16=(ROUNDUP(DAY(D16)/7,0))&IF(AND(MOD(ABS(ROUNDUP(DAY(D16)/7,0)),100)>10,MOD(ABS(ROUNDUP(DAY(D16)/7,0)),100)<14),"th",CHOOSE(MOD(ABS(ROUNDUP(DAY(D16)/7,0)),10)+1,"th","st","nd","rd","th","th","th","th","th","th"))&" "&E16
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D49,D52,D16:D23,D26:D29,D32,D37:D46Expression=WEEKDAY(D16,2)>5textNO


So in cell G16 I want to list which day of the week, in this case which Monday the date falls on. I ended up nesting [Formula 1] into the cell reference calls in [Formula 2] and then called on the day of the week in format dddd in cell E16 to be added on the end using the combined formula:

=(ROUNDUP(DAY(D16)/7,0))&IF(AND(MOD(ABS(ROUNDUP(DAY(D16)/7,0)),100)>10,MOD(ABS(ROUNDUP(DAY(D16)/7,0)),100)<14),"th",CHOOSE(MOD(ABS(ROUNDUP(DAY(D16)/7,0)),10)+1,"th","st","nd","rd","th","th","th","th","th","th"))&" "&E16

It works like a charm.

I hope it helps others who might also need this.

Best regards,
Haydn
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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