cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
emmahuynh
Helper II
Helper II

Round up when Dividing numbers

Hello Teams, I'm using 'Div' function to divide a number by 30 and I want to round up the result. For example, 139/30 = 4.6666....The flow returns the result as 4 , but I want to get the Round Up result, which is 4.666 becomes 5 (whole integer). I tried "int(first(split(string(variables('ee')),'.')))" a solution from another post but it seems not work for me. How should I round up the result? Thanks
2 ACCEPTED SOLUTIONS

Accepted Solutions
Jcook
Super User III
Super User III

Hello @emmahuynh 


could you try this:

if(Mod(float(30),139) > .49,div(float(30),139)+1,div(float(30,139))

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

edgonzales
Super User II
Super User II

@emmahuynh 

Hey there.  You could also use the Format Number action, put your dynamic value (or div expression) in the Number field, and then for the Format, select "Add a custom item", and in the pop-up, just enter '#' (without the quotes) and click ok.

20200817e.PNG
The output from that action should be a rounded, whole integer.

 

Either way, keep us posted.  Good luck!

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

3 REPLIES 3
Jcook
Super User III
Super User III

Hello @emmahuynh 


could you try this:

if(Mod(float(30),139) > .49,div(float(30),139)+1,div(float(30,139))

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

edgonzales
Super User II
Super User II

@emmahuynh 

Hey there.  You could also use the Format Number action, put your dynamic value (or div expression) in the Number field, and then for the Format, select "Add a custom item", and in the pop-up, just enter '#' (without the quotes) and click ok.

20200817e.PNG
The output from that action should be a rounded, whole integer.

 

Either way, keep us posted.  Good luck!

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

thanks so much. This solution works for me.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (11,438)