web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Automatically Enter La...
Power Automate
Answered

Automatically Enter Last Friday of the Month

(0) ShareShare
ReportReport
Posted on by 158

Hello,

I am creating a PA Desktop flow that transfers data between two Excel spreadsheets. For one of the columns I am trying to have the cell values be the last Friday of the current month. How can I implement this without having to manually type out the date in the action that populates the cell?

 

Screenshot 2023-06-13 at 7.28.20 PM.png

I have the same question (0)
  • Verified answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @OnurOnal 

     

    First you should find the last friday date to populate that date into cell

     

    The logic i have used here is 

     

    1. find the first date of next month

    2. do looping by subtracting 1 day from that month until until u get next first friday which would be last friday of current month 

     

    use below code and paste in power automate desktop 

     

    DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateOnly CurrentDateTime=> CurrentDateTime
    DateTime.Add DateTime: CurrentDateTime TimeToAdd: 1 TimeUnit: DateTime.TimeUnit.Months ResultedDate=> ResultedDate
    SET NextMonthDate TO $'''1/%ResultedDate.Month%/%ResultedDate.Year%'''
    Text.ConvertTextToDateTime.ToDateTime Text: NextMonthDate DateTime=> TextAsDateTime
    SET LFridayFound TO False
    LOOP WHILE (LFridayFound) = (False)
    DateTime.Add DateTime: TextAsDateTime TimeToAdd: -1 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> TextAsDateTime
    IF TextAsDateTime.DayOfWeek = $'''Friday''' THEN
    SET LFridayFound TO True
    END
    END
    Text.ConvertDateTimeToText.FromDateTime DateTime: TextAsDateTime StandardFormat: Text.WellKnownDateTimeFormat.ShortDate Result=> FormattedDateTime
    Display.ShowMessageDialog.ShowMessage Message: $'''Last Friday Date is %FormattedDateTime%''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed

     

     

    Screenshot of the flow

    Nived_Nambiar_0-1686710866215.png

     

    Nived_Nambiar_1-1686710879947.png

     

     

    for demo purposes i am displaying the last friday date by message which in your case is not needed 🙂

     

    Hope it helps !

    Mark it as solution if it resolves your query !

     

     

  • OnurOnal Profile Picture
    158 on at

    Hello @Nived_Nambiar,

     

    The flow works great! Thank you for the help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 238 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 225

#3
Haque Profile Picture

Haque 181

Last 30 days Overall leaderboard