# Select by float ranges?

**URL:** <https://forums.unrealengine.com/t/select-by-float-ranges/1884470>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [June 1, 2024, 7:42pm UTC](https://forums.unrealengine.com/t/select-by-float-ranges/1884470 "2024-06-01T19:42:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krazay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Krazay](https://forums.unrealengine.com/u/Krazay)\
**Post date:** [June 1, 2024, 7:42pm UTC](https://forums.unrealengine.com/t/select-by-float-ranges/1884470/1 "2024-06-01T19:42:39Z")

</div>

Anyone know a cleaner way to select on float ranges.

 ![Screenshot 2024-06-01 152721](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/1/7c14ab0d083c05765f9aa77abbbc76fc0540ca30.png)

---

<div class="post-metadata">

**Author:** ![GRIM\_Warlock](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/grim_warlock/32/642970_2.png) [@GRIM\_Warlock](https://forums.unrealengine.com/u/GRIM_Warlock)\
**Post date:** [June 1, 2024, 8:23pm UTC](https://forums.unrealengine.com/t/select-by-float-ranges/1884470/2 "2024-06-01T20:23:26Z")

</div>

Hey @Krazay

You can create a Struct to store your options and ranges, and make an array to loop through and find the right montage if there’s one.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/d/3/ed30644c026cb296dcfb03d789f4419ae54a5ec8.png)  
─  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/5/9/759f2fec1ca5f3e2cb1127a3a52a9c14540eff6e.png)  
─  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/1/5/31504cb5fc12d7048653f220f0bf7fe6e78223f6.png)

Then the logic to find the montage

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/2/7/627af7ffd930ce967e3a499a040f46569204864f.png)  
─  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/3/e/33ef1c448d0078d611ceac3dabfcc0bfff48c660.png)

This way you don’t have to stack up branches, you can just modify the struct array and it will work

---

<div class="post-metadata">

**Author:** ![Nawrot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nawrot/32/618260_2.png) [@Nawrot](https://forums.unrealengine.com/u/Nawrot)\
**Post date:** [June 1, 2024, 9:58pm UTC](https://forums.unrealengine.com/t/select-by-float-ranges/1884470/3 "2024-06-01T21:58:35Z")

</div>

If ranges do not overlap:

- create array of your float ranges (in ascending order)
- in for loop check if input value is \>= than float from array
- if it is use for loop index as value to switch on
- use that with switch on int.

Or you can extend that with struct that holds two floats: min and max.  
Basically you are seeking for first matching entry. Ie. InputValue is \>= min and \<= max from struct.  
When you find it for loop index is your value to switch on int.

Then you can collapse whole thing into function, feed result to switch on int.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 1, 2024, 9:58pm UTC](https://forums.unrealengine.com/t/select-by-float-ranges/1884470/4 "2024-07-01T21:58:47Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
