Reputation: 711
I want to write a function in excel to test if user entered a valid note name for given string number in a guitar.
6th string(E) - mi
5th string(A) - la
4th string(D) - re
3rd string(G) - sol
2nd string(B) - si
1st string(E) - mi
A B C
1 2 si true
2 4 re true
3 5 sol false
4 6 mi true
. . . .
Column A will be random generated between [1-6] as string number. User will input column B as corresponding musical note. I want to write the function for column C which will test if random generated string number matches user entered note name. What would be the most efficient function to do this comparison?
Upvotes: 0
Views: 86
Reputation: 35915
You can use the Choose() function for that. Consider the following screenshot:
The formula in cell C1 is
=B1=CHOOSE(A1,"mi","si","sol","re","la","mi")
If your scenario is more complex than this example, you may want to consider a table where each note name text is matched to a value and use a lookup table instead.
This example is not related to the guitar strings, though, just the position of the note name on the scale. Adjust as suits.
Upvotes: 1