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 / Power Automate Desktop...
Power Automate
Answered

Power Automate Desktop or Excel Macro Initiated by PAD?

(0) ShareShare
ReportReport
Posted on by 5

My question has to do with identifying the best method to perform 2 tasks in Excel. I have the following data:

 

DATE               Rate

11/30/2021(0.00)
11/30/2021(0.02)
11/30/2021(0.01)
12/31/20210.00
12/31/2021(0.01)
1/31/2022(0.01)
5/31/20220.04
12/31/20220.13
1/15/20230.14
12/31/20230.30
12/31/20230.30
1/31/20240.32
6/30/20240.41
12/31/20240.51
12/31/20240.51
1/31/20250.54
1/31/20250.52
11/30/20250.68
12/31/20250.71
12/31/20250.70
1/31/20260.72
11/15/20260.80
11/30/20260.83
12/31/20260.83

 

I need to delete every row except for the last date of each year and format the rates as percentages:

 

12/31/2021- .01%
12/31/20220.13%
12/31/20230.30%
12/31/20240.51%
12/31/20250.70%
12/31/20260.83%

 

Can this all be done with PAD or do I need to create a macro in Excel VB? I don't see any PAD actions that appear as if they will do this but I want to make sure I'm not missing anything. Any help would be appreciated.

I have the same question (0)
  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    I’m a firm believer in writing the macro, and just using PAD to run it. It is insanely faster. 

    If you really just want to use PAD, here is the logic:

     

    • Get last row
    • create data table
    • set variable %datatablerowindex% to 0
    • Loop starting at %lastrow% to 1 (or 2 if you have a title row) increment -1
      • Read excel A and %loopindex%
      • if %loopindex% = %last row%
        • Add value to %DataTable[0][0]%
        • read excel B and %loopindex%
        • write to %Datatable[0][1]
        • next loop
      • #else if loopindex <> last row
      • Set %datatablerowindex% to %datatablerowindex+1%
      • read from A and %loopindex%
        • if %read% = %Datatable [datatablerowindex - 1][0]
        • next loop
      • #if %read% <> %Datatable [datatablerowindex - 1][0]
      • Add %read% to %DataTable[datatablerowindex][0]%
      • read excel B and %loopindex%
      • write to %Datatable[datatablerowindex][1]%
      • next loop
    • End Loop

    The datable will be backwards, but you can sort it forward. If there is not a feature for sorting it, do a  backwards “for each” and add it to another list making it go the right way.  When writing to the datable, you should be able to say “write %read%%% to %Datatable[Datatablerowindex][1]%. The two extra %s should be a text % at the end. 

    Best of luck!

  • MrLupin Profile Picture
    5 on at

    Wow! Thank you!! This is very very helpful!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 482

#2
11manish Profile Picture

11manish 280

#3
David_MA Profile Picture

David_MA 268 Super User 2026 Season 1

Last 30 days Overall leaderboard