cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Data_Enthusiast
Post Patron
Post Patron

Limit value returned from multiplication

Hi Power Apps Community,
I would like to multiply two numbers together, BUT the value resulted from the multiplication should not exceed a certain amount. For example, I have a variable for the max amount which is 10. 

So if I say 2 * 2 = 4, then the value returned should be 4.
However, if I say 4 * 4 = 12 (which exceeds the max of 10), then the value returned should be the max amount of 10.
I would really appreciate any assistance.

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

Consider this:

If(
Value(TextInput2.Text) * Value(TextInput1.Text) > 10,
10,
Value(TextInput2.Text) * Value(TextInput1.Text)
)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

2 REPLIES 2
eka24
Super User
Super User

Consider this:

If(
Value(TextInput2.Text) * Value(TextInput1.Text) > 10,
10,
Value(TextInput2.Text) * Value(TextInput1.Text)
)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

gabibalaban
Super User
Super User

Hi @Data_Enthusiast ,

 

Use IF() function:

If (value1*value2 > MaxAllowedValue, MaxAllowedValue, value1*value2)

 

4*4=12 (what am I missing ?)

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,342)