# Conditional Formatting for Artist based on Album Artist

**URL:** <https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230>\
**Category:** Support\
**Created:** [July 8, 2018, 7:09am UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230 "2018-07-08T07:09:22Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 10, 2018, 6:08am UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/21 "2018-07-10T06:08:22Z")

</div>

Thank you for your reply.

So should I introduce those as two new lines of code or am I supposed to replace existing?

Either $if($eql(%artist%,%albumartist%),1,0) could be implemented before Guess values, before Format value Filename/Title or replaces one or more of these?

Or was that just an example and the true coding is the second line you mentioned Format string: $if($eql(%artist%,%albumartist%),%feat\_artist%,%artist%)?

---

<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:** [July 10, 2018, 6:16am UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/22 "2018-07-10T06:16:07Z")

</div>

> [@sheepdisease](#):
>
> the true coding is the second line you mentioned

Yes.

The sequence I see is:  
First guess value so that the FEAT\_ARTIST has a chance to get filled with the after-comma-data.  
Now compare ARTIST and ALBUMARTIST - if they to not match, write ARTIST to FEAT\_ARTIST otherwise leave FEAT\_ARTIST as it is.  
Now I would update the TITLE with [feat ...]  
and finally rename the file with  
%track% %title%  
(as TITLE should contain the feat... part by now. In that order you do not have to add the feat... part twice: once to TITLE and once to \_FILENAME)

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 10, 2018, 6:25am UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/23 "2018-07-10T06:25:06Z")

</div>

Thank you.

So is this correct?

![](https://community.mp3tag.de/uploads/default/original/2X/3/3a9387603a14bad58048c0c1378d3b6a81aacd47.png)

---

<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:** [July 10, 2018, 6:30am UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/24 "2018-07-10T06:30:41Z")

</div>

I don't think so.  
Actions 1&2&3: ok  
Action 4 should have FEAT\_ARTIST as field to be formatted and not \_FILENAME  
Action 5 & 6 are a complete chaos of target fields and format strings.  
Action 5 should format TITLE with format string: %title%[(feat. %feat\_artist%)]  
Action 6 should format \_FILENAME with format string: %track% \_ %title%

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 10, 2018, 6:40am UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/25 "2018-07-10T06:40:28Z")

</div>

Thank you, that makes sense.

It seems to be working for the most part.

However, it adds the track number to the filename again so for example '15 Lost Stars' turns into '15 15 Lost Stars (feat. Adam Levine)' and the artist name remains Adam Levine rather than being replaced by Album Artist.

---

<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:** [July 10, 2018, 6:44am UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/26 "2018-07-10T06:44:34Z")

</div>

The track number was not introduced by me.  
Yes the ARTIST is still the old value as you did not take this into account

> [@ohrenkino](#):
>
> I would spare me another comparison of ALBUMARTIST and ARTIST as by now it should be clear that ALBUMARTIST and ARTIST should always show the same (and if they don't - "take this") so simply add an action of the type "Format value" for ARTIST

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 10, 2018, 5:17pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/27 "2018-07-10T17:17:01Z")

</div>

Right you are! Thank you.

Think I have cracked it:

![](https://community.mp3tag.de/uploads/default/original/2X/2/20efd7e7a976b28bd0cab635c3e93cdc734fae35.png)

> [#0]  
> T=4  
> F=TRACK  
> 1=^(\D+)/\D+  
> 2=$1  
> 3=0
> 
> [#1]  
> T=5  
> F=TRACK  
> 1=[$num(%track%,1)]
> 
> [#2]  
> T=7  
> F=%artist%  
> 1=%artist%, %feat\_artist%
> 
> [#3]  
> T=5  
> F=FEAT\_ARTIST  
> 1=$if($eql(%artist%,%albumartist%),%feat\_artist%,%artist%)
> 
> [#4]  
> T=5  
> F=TITLE  
> 1=%title%[(feat. %feat\_artist%)]
> 
> [#5]  
> T=5  
> F=\_FILENAME  
> 1=%track% %title%
> 
> [#6]  
> T=5  
> F=ARTIST  
> 1=%albumartist%

I will continue to test. Does it look okay to you? Can you anticipate there being any problems?

I have. It seems if you inadvertently run the code on a file already amended it starts duplicating. Can this be stopped by using an if condition?

---

<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:** [July 10, 2018, 5:26pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/28 "2018-07-10T17:26:46Z")

</div>

> [@sheepdisease](#):
>
> It seems if you inadvertently run the code on a file already amended it starts duplicating. Can this be stopped by using an if condition?

What gets duplicated?  
And even if so: apply a filter that filters for FEAT\_ARTIST MISSING because none of the untreated files should have that field.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 10, 2018, 5:42pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/29 "2018-07-10T17:42:16Z")

</div>

The part in brackets:

 ![](https://community.mp3tag.de/uploads/default/original/2X/2/2b6f36cfc4ac6277968c5cb21399780fe44fe295.png)

---

<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:** [July 10, 2018, 5:48pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/30 "2018-07-10T17:48:16Z")

</div>

If you run action #4 twice, you add another feat. artist.  
That is why I suggested to filter.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 10, 2018, 7:34pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/31 "2018-07-10T19:34:47Z")

</div>

You mean this filter? "$if($eql(%artist%,%albumartist%),1,0)" IS 0

I have that applied but it still brings up tracks which include feat in them (that I have not applied this code to).

 ![](https://community.mp3tag.de/uploads/default/original/2X/4/4a48b4714a0eb0083a6b7dc7d4e72a477c88f044.png)

Not sure how/why this is happening?

---

<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:** [July 10, 2018, 7:55pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/32 "2018-07-10T19:55:19Z")

</div>

Have a look at the help about filtering and you will recognize the filter expression in

> [@Conditional Formatting for Artist based on Album Artist](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/28):
>
> What gets duplicated? And even if so: apply a filter that filters for FEAT\_ARTIST MISSING because none of the untreated files should have that field.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 10, 2018, 9:33pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/33 "2018-07-10T21:33:37Z")

</div>

Okay, I will try to experiment with that.

In the mean time I have come up with the following when this scenario comes up:

![](https://community.mp3tag.de/uploads/default/original/2X/7/7195cc2aeb3cfc25d5e57596d6548476dfa18ef0.png)

> [#0]  
> T=4  
> F=TRACK  
> 1=^(\D+)/\D+  
> 2=$1  
> 3=0
> 
> [#1]  
> T=5  
> F=TRACK  
> 1=[$num(%track%,1)]
> 
> [#2]  
> T=7  
> F=%artist%  
> 1=%artist%, %feat\_artist%
> 
> [#3]  
> T=5  
> F=FEAT\_ARTIST  
> 1=$if($eql(%artist%,%albumartist%),%feat\_artist%,%artist%)
> 
> [#4]  
> T=5  
> F=ARTIST  
> 1=%albumartist%

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 10, 2018, 9:59pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/34 "2018-07-10T21:59:33Z")

</div>

I was having problems with some folders including 'single' or 'album' or 'ep' or 'lp' in the folder name so I updated the code.

![image](https://community.mp3tag.de/uploads/default/original/2X/f/fc5e6d5131a07c4073a8a9fda57b958a83c0529a.png)

```
[#0]
T=4
F=TRACK
1=^(\\D+)/\\D+
2=$1
3=0

[#1]
T=5
F=TRACK
1=[$num(%track%,1)]

[#2]
T=7
F=%artist%
1=%artist%, %feat_artist%

[#3]
T=5
F=FEAT_ARTIST
1=$if($eql(%artist%,%albumartist%),%feat_artist%,%artist%)

[#4]
T=5
F=ARTIST
1=%albumartist%

[#5]
T=4
F=_DIRECTORY
1= \\(Album\\)
2=
3=0

[#6]
T=4
F=_DIRECTORY
1= \\(Single\\)
2=
3=0

[#7]
T=4
F=_DIRECTORY
1= \\(LP\\)
2=
3=0

[#8]
T=4
F=_DIRECTORY
1= \\(EP\\)
2=
3=0

```

Do you see this being problematic/is there a better way to code it?

---

<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:** [July 11, 2018, 5:31am UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/35 "2018-07-11T05:31:31Z")

</div>

If you replace text constants like "(Album)" then it is not necessary to use a regular expression (that is specifically good if you deal with patterns of variable contents) but just a plan "Replace".  
I would use an action of the type "Format value" for \_DIRECTORY to get a unified naming scheme. So instead of cutting away pieces of the string, rewrite it completely with e.g.  
Format string: %year% - %album%

---

<div class="post-metadata">

**Author:** ![NashvilleKit](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nashvillekit/32/5441_2.png) [@NashvilleKit](https://community.mp3tag.de/u/NashvilleKit)\
**Post date:** [July 12, 2018, 3:22pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/36 "2018-07-12T15:22:58Z")

</div>

I have a specific and peculiar problem with Artist vs Album Artist. I used to have my cell phone music (~2000 tracks) all done up nicely with both fields correct. If the track is "Moves Like Jagger," then Artist was "Maroon 5 & Christina Aguilera" and Album Artist was "Maroon 5." HOWEVER, I bought a new car with Bluetooth and I can play music with my phone in my pocket and it's displayed on a dash panel. BUT ... the display shows Title and Artist only and it was Album Artist it was displaying. I experimented & found if there was no Album Artist tag, it would display just Artist. SO, I did an Mp3tag export and looked for all case where Artist & Album Artist were not equal and blanked out the Album Artist tag in those cases. Now my car display really shows me who the artist is! (It bothers my perfection gene, but if I ever wanted to fix the tags as they should be, it would be pretty easy.)

---

<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:** [July 12, 2018, 3:36pm UTC](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230/37 "2018-07-12T15:36:29Z")

</div>

@NashvilleKit: what does your description have to do with the problem of moving the featured artist to the title?

---

<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/conditional-formatting-for-artist-based-on-album-artist/42230/38 "2026-02-09T12:27:30Z")

</div>



[Previous page](https://community.mp3tag.de/t/conditional-formatting-for-artist-based-on-album-artist/42230.md?page=1)
