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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate Desktop...
Power Automate
Unanswered

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard