IFS

Jewells0905

New Member
Joined
Mar 10, 2024
Messages
42
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I am trying to translate the numbers from column D to text strings as follows: 0 = "A", 1 = "A#/Bb", 2 = "B", 3 = "C", 4 = "C#/Db", 5 = "D", 6 = "D#/Eb", 7 = "E", 8 = "F", 9 = "F#/Gb", 10 = "G", and 11 = "G#/Ab", into column E. This is the formula I'm using, which is not giving an error, but not quite correct. I'm getting A#Bb for all of them.

=IFS( D2= 0, "A", 1, "A#/Bb", 2, "B", 3, "C", 4,"C#/Db", 5, "D", 6, "D#/Eb", 7, "E", 8, "F", 9, "F#/Gb", 10, "G",11, "G#/Ab")

YearTitleArtistKey OrigKeyTop 10
2010This Is the House That Doubt BuiltA Day to Remember11A#/Bb0
2010Sticks & BricksA Day to Remember10A#/Bb0
2010All I WantA Day to Remember2A#/Bb0
2010It's ComplicatedA Day to Remember1A#/Bb0
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
try using SWITCH instead:

edited:

Book2
ABCDEFGHIJ
1YearTitleArtistKey OrigKeyTop 10
22010This Is the House That Doubt BuiltA Day to Remember0A#/Bb0A
32010Sticks & BricksA Day to Remember1A#/Bb0A#/Bb
42010All I WantA Day to Remember2A#/Bb0B
52010It's ComplicatedA Day to Remember3A#/Bb0C
64C#/Db
75D
86D#/Eb
97E
108F
119F#/Gb
1210G
1311G#/Ab
1412Error
Sheet2
Cell Formulas
RangeFormula
J2:J14J2=SWITCH(D2,0,"A",1,"A#/Bb",2,"B",3,"C",4,"C#/Db",5,"D",6,"D#/Eb",7,"E",8,"F",9,"F#/Gb",10,"G",11,"G#/Ab","Error")
 
Upvote 0
Solution
try using SWITCH instead:

edited:

Book2
ABCDEFGHIJ
1YearTitleArtistKey OrigKeyTop 10
22010This Is the House That Doubt BuiltA Day to Remember0A#/Bb0A
32010Sticks & BricksA Day to Remember1A#/Bb0A#/Bb
42010All I WantA Day to Remember2A#/Bb0B
52010It's ComplicatedA Day to Remember3A#/Bb0C
64C#/Db
75D
86D#/Eb
97E
108F
119F#/Gb
1210G
1311G#/Ab
1412Error
Sheet2
Cell Formulas
RangeFormula
J2:J14J2=SWITCH(D2,0,"A",1,"A#/Bb",2,"B",3,"C",4,"C#/Db",5,"D",6,"D#/Eb",7,"E",8,"F",9,"F#/Gb",10,"G",11,"G#/Ab","Error")
worked perfectly! Thank you!
 
Upvote 0
My pleasure, happy to help. Best wishes!
 
Upvote 1
worked perfectly! Thank you!
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.

I am not a fan of the IFS function at all but for the record the reason your formula was not working was because you omitted the D2 reference from all the tests except the first one.
IFS could have worked, as shown in col K below.
A more compact way to do this though is shown in Col J

Cell Formulas
RangeFormula
J2:J13J2=INDEX({"A","A#/Bb","B","C","C#/Db","D","D#/Eb","E","F","F#/Gb","G","G#/Ab"},D2+1)
K2:K13K2=IFS( D2= 0, "A", D2=1, "A#/Bb", D2=2, "B", D2=3, "C", D2=4,"C#/Db", D2=5, "D", D2=6, "D#/Eb", D2=7, "E", D2=8, "F", D2=9, "F#/Gb", D2=10, "G",D2=11, "G#/Ab")
L2:L13L2=SWITCH(D2,0,"A",1,"A#/Bb",2,"B",3,"C",4,"C#/Db",5,"D",6,"D#/Eb",7,"E",8,"F",9,"F#/Gb",10,"G",11,"G#/Ab","Error")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,107
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top