cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JC75
Level: Powered On

Help Replicating Excel Forumlas into PowerApps form

Version:1.0 StartHTML:000000239 EndHTML:000003880 StartFragment:000002014 EndFragment:000003848 StartSelection:000002014 EndSelection:000003844 SourceURL:https://powerusers.microsoft.com/t5/forums/postpage/board-id/PowerAppsForum1

Hi I have an excel sheet that contains various formulas to calculate values based around a set of user defined dates.

 

Im trying to create a PowerApps form that will populate an Sharepoint List with the values the user enters and the calculations it shows from what they entered.

 

User entered Dates are Date of Birth(DOB), JoinDate, LeaveDate2.

I have managed to already calculate Age at Joining(as an Age) and date will or was 41 (as a date) which populate labels on the form.

 

Im now  trying to calculate years of service < 41 and years of service >41 

 

In excel this is achieved using the following formula - through 4 formulas.

 

Calculation 1 - is 

 

=ROUND(IF(F2<C2,"0",IF(F2<A2,(F2-C2)/365.25,(A2-C2)/365.25)),2)

 

Calculation 2  is 

 

=ROUND(IF(F2>A2,"0",IF(F2<C2,(A2-C2)/365.25,(A2-F2)/365.25)),2)

 

The value from Calculation 1 is then passed to Service <41 using the follwing forumla

 

=IF(C2=0,0,IF(G4+H4<20,G4,IF(H4=20,"0",IF(H4<20,20-H4,"20"))))

 

The value from calculation 2 is passed to service >41 using

 

=IF(H4="0",H4,IF(H4>20,20,H4))

 

For ease here is a shot of the worksheet in excel

Capture.PNG

 

Ive tried to replicate the Caluclation formula 1 - to a label control on the Powerapps form setting the text to the following format but it isnt working

 

Round(If((DateValue(Age41Text.Text)<DateValue(JoinDateText.Text), 0,If((DateValue(Age41Text.Text)<DateValue(LeaveDate2.Text),(DateValue(Age41Text.Text)-DateValue(JoinDateText.Text))/365.25,(DateValue(LeaveDate2.Text)-DateValue(JoinDateText.Text))/365.25)),2)

 

Any ideas how I can do this?

 

 

 

1 REPLY 1
Leo09
Level 8

Re: Help Replicating Excel Forumlas into PowerApps form

Excel formulas are not the same in PowerApps I think. The former focuses on calculations more. I do not think this could be achieved in PowerApps.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 314 members 6,239 guests
Please welcome our newest community members: