# Divide a positive or negative decimal value

**URL:** https://community.mp3tag.de/t/divide-a-positive-or-negative-decimal-value/41910
**Category:** Support
**Created:** [June 10, 2018, 1:19pm UTC](https://community.mp3tag.de/t/divide-a-positive-or-negative-decimal-value/41910 "2018-06-10T13:19:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![thecoreyburton](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@thecoreyburton](https://community.mp3tag.de/u/thecoreyburton)
#### Post date: [June 10, 2018, 1:19pm UTC](https://community.mp3tag.de/t/divide-a-positive-or-negative-decimal-value/41910/1 "2018-06-10T13:19:49Z")

</div>

Hi! I've used the program for quite some time, but I've only recently started experimenting with actions (previously I'd handled everything manually).

I'm looking to halve a set of values in the COMMENT field. They're all positive or negative values with two numbers following the decimal point. As an example list, I have the following values:  
+7.15  
-0.06  
+1.41  
+0.00  
-3.55

I'd like to set these values to half of their respective starting values using an action, if possible. I've experimented myself and have the following so far:

1. This removes the decimal point and effectively multiplies all values by 100.  
Format value "COMMENT".  
$replace(%comment%,.,)

2. This halves the new values.  
Format value "COMMENT"  
$div(%comment%,2)

The third step is currently the problem. I'd like to match the input formatting with the output formatting. This means all values should have either a + or - before them (including +0.00), and should have a decimal point followed by two digits, even if they're both zeroes. It also might be worth noting that the values will never exceed +90 or -90, so a scenario with three digits before the decimal point is not possible.

I've been experimenting with $ifgreater and $left to try and calculate a new value with a decimal point, but my results so far have not even been close to what I'd expect, but that's probably because I'm new at this.

Any help would be greatly appreciated, and thank you for taking the time to read this.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [June 10, 2018, 2:35pm UTC](https://community.mp3tag.de/t/divide-a-positive-or-negative-decimal-value/41910/2 "2018-06-10T14:35:40Z")

</div>

Perhaps you find inspiration here:

> [@Decimal points - can you control them](https://community.mp3tag.de/t/decimal-points-can-you-control-them/13532):
>
> Hi, one of the MP3 tags I work with is BPM - by default this often has 2 digits after the decimal point but this causes me problems can MP3tag allow you to control decimal points, just as you can when dealing with numerical fields in Excel - so you can have 0,1 or 2? much appreciated if someone can tell me thanks

---

<div class="post-metadata">

### Author: ![ryerman](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ryerman/32/5285_2.png) [@ryerman](https://community.mp3tag.de/u/ryerman)
#### Post date: [June 10, 2018, 5:31pm UTC](https://community.mp3tag.de/t/divide-a-positive-or-negative-decimal-value/41910/3 "2018-06-10T17:31:34Z")

</div>

Try this format string:  
$regexp(%comment%,'([+-]).+',$1)$regexp($num($regexp($div($replace(%comment%,.,),2),'(-\*)(.+)',$2),3),'(\d+)(\d\d$)',$1.$2)

---

<div class="post-metadata">

### Author: ![thecoreyburton](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@thecoreyburton](https://community.mp3tag.de/u/thecoreyburton)
#### Post date: [June 11, 2018, 2:51am UTC](https://community.mp3tag.de/t/divide-a-positive-or-negative-decimal-value/41910/4 "2018-06-11T02:51:09Z")

</div>

@ryerman That worked perfectly, thank you. I tested it on ~50 example files and the results were all correct!

@ohrenkino Thank you for that link. Not only did it help me get further on my own trials, but it also gave me a few ideas on how to creatively use actions in the program, which will be invaluable in the future.

I greatly appreciate the help. Thank you both!

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:27pm UTC](https://community.mp3tag.de/t/divide-a-positive-or-negative-decimal-value/41910/5 "2026-02-09T12:27:28Z")

</div>


