# \[?\] Select and replace on a 2D lists of data?

**URL:** <https://community.wolfram.com/t/select-and-replace-on-a-2d-lists-of-data/10783>\
**Category:** Questions\
**Created:** [July 3, 2017, 1:40pm UTC](https://community.wolfram.com/t/select-and-replace-on-a-2d-lists-of-data/10783 "2017-07-03T13:40:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauledigbue](https://avatars.discourse-cdn.com/v4/letter/p/779978/32.png) [@pauledigbue](https://community.wolfram.com/u/pauledigbue)\
**Post date:** [July 3, 2017, 1:40pm UTC](https://community.wolfram.com/t/select-and-replace-on-a-2d-lists-of-data/10783/1 "2017-07-03T13:40:30Z")

</div>

How do I select range of elements on a 2D lists of data and replace the selected elements with a specified range of values. For example  
if

```
K = {{4, 6, 7, -8, 2, 1, 9, 6, 10, 1}, {2, 2, 3, 9, -10, 3, 4, 7, 8, 1}, {5, 4, 2, 1, 10, 8, 7, 3, -9, 5}}

```

I like to select elements in the range of (5 to 10) and range of (-5 to -10), replace all the selected with range of (1 to 3) and (-1 to -3) respectively.

---

<div class="post-metadata">

**Author:** ![neils](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/neils/32/20595_2.png) [@neils](https://community.wolfram.com/u/neils)\
**Post date:** [July 3, 2017, 4:14pm UTC](https://community.wolfram.com/t/select-and-replace-on-a-2d-lists-of-data/10783/2 "2017-07-03T16:14:10Z")

</div>

You need to give some examples. I don’t understand what you are asking. For example, How do you know what to replace a value with if you are replacing 5 values in the range of 5 to 10 with 3 values in the range of 1 to 3?

---

<div class="post-metadata">

**Author:** ![pauledigbue](https://avatars.discourse-cdn.com/v4/letter/p/779978/32.png) [@pauledigbue](https://community.wolfram.com/u/pauledigbue)\
**Post date:** [July 3, 2017, 6:08pm UTC](https://community.wolfram.com/t/select-and-replace-on-a-2d-lists-of-data/10783/3 "2017-07-03T18:08:06Z")

</div>

I want to replace values higher than a specific number e.g 5 and -5, with specific values e.g replace 5 with 2 and -5 with -2.

---

<div class="post-metadata">

**Author:** ![neils](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/neils/32/20595_2.png) [@neils](https://community.wolfram.com/u/neils)\
**Post date:** [July 3, 2017, 7:23pm UTC](https://community.wolfram.com/t/select-and-replace-on-a-2d-lists-of-data/10783/4 "2017-07-03T19:23:19Z")

</div>

How do I select and replace on a 2D lists of data?.

---

<div class="post-metadata">

**Author:** ![neils](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/neils/32/20595_2.png) [@neils](https://community.wolfram.com/u/neils)\
**Post date:** [July 3, 2017, 7:50pm UTC](https://community.wolfram.com/t/select-and-replace-on-a-2d-lists-of-data/10783/5 "2017-07-03T19:50:53Z")

</div>

Strange how it duplicated your post under my name…

What I posted was that you can certainly use Map[] to map a replacement function over your list with “rules” in it. or if your replacement is as simple as you indicate, you can just do:

```
K /. {5-> 2, -5 -> -2}

```

Regards
