# Conditionally add, remove or change a tag?

**URL:** https://community.mp3tag.de/t/conditionally-add-remove-or-change-a-tag/4041
**Category:** Support
**Created:** [November 10, 2006, 8:54pm UTC](https://community.mp3tag.de/t/conditionally-add-remove-or-change-a-tag/4041 "2006-11-10T20:54:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [November 10, 2006, 8:54pm UTC](https://community.mp3tag.de/t/conditionally-add-remove-or-change-a-tag/4041/1 "2006-11-10T20:54:55Z")

</div>

Is there a way to conditionally add or remove a tag based upon either its value or the existance of the tag itself? Similarly, I'd like to be able to conditionally modify tags based their value. Some actions I'd like to run across my whole library.

```
If (NOT TagExists("COMPILATION")) Then
  AddTag("COMPILATION=0")

If (ALBUMARTIST == "Various Artists") Then
  RemoveTag("ALBUMARTIST")

If (ARTIST == "Cannonball Adderley") Then
  SetTag("ARTIST=Julian Adderley")
```

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [November 10, 2006, 10:08pm UTC](https://community.mp3tag.de/t/conditionally-add-remove-or-change-a-tag/4041/2 "2006-11-10T22:08:29Z")

</div>

The 2nd example is the same as here:  
[/t/3948/1](https://community.mp3tag.de/t/3948/1)  
The two others are very similar.  
To check if a tag field exist a simple $if(%tag%,yes,no) suffices.

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [November 10, 2006, 10:33pm UTC](https://community.mp3tag.de/t/conditionally-add-remove-or-change-a-tag/4041/3 "2006-11-10T22:33:25Z")

</div>

Thanks. Forgot I'd already asked, and I guess I missed the reply.

---

<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:19pm UTC](https://community.mp3tag.de/t/conditionally-add-remove-or-change-a-tag/4041/4 "2026-02-09T12:19:59Z")

</div>


