Question: I export Excel files from a website. The exported files have number values with a currency sign before them in a number of columns although the number format of the cells is "General".

I want to remove the currency sign.  

Another tricky thing is the headers of these columns and even the column indexes are not constant.

Is there a way to select the cells/columns and remove the currency sign that can work on any Excel file I am working on? Is there an easier solution?

Example of the problem:  

[![enter image description here](https://i.stack.imgur.com/fcaBx.png)](https://i.stack.imgur.com/fcaBx.png)

Answer: 
You could do it by combining the colors into a key, and switching on that key:

```
function colorMix (color1, color2){
    const key = color1 < color2 ? color1 + " \t " + color2 : color2 + " \t " + color1;
    switch (key) {
        case "blue \t red":
            return "violet";
        case "red \t yellow");
            return "orange";
        case "blue \t yellow";
            return "green";
        default:
            return return "need to mix two diferent colours";
    }
}

```

That assumes colors names won't have space/tab/space in them.

That works because we're using strings we can combine into a single key. If we didn't, or the expressions were more complex, then while it would be **possible** to do this with a `switch`, there'd be no good reason to, you'd basically be writing the same thing as the `if`/`else if` chain (because in JavaScript, that's all `switch` is — unlike some other languages with similar syntax), and the result would be **really** surprising to anyone else reading the code.

For completeness, here's that general case:

```
// DON'T DO THIS
switch (true) {
    case (color1 === 'red' && color2 === 'blue') || (color1 === 'blue' && color2 === 'red'):
        return 'violet';
    case (color1 === 'red' && color2 === 'yellow') || (color1 === 'yellow' && color2 === 'red'):
        return 'orange';
    // ...
}

```

That works because case labels are expressions in JavaScript, which are tested in order (except for `default`), with the first match being used.

But again, don't do that. :-D

You might also consider a lookup table:

```
// Creates a key for the two colors, where the colors are always
// in lexicographical order (so we don't have to worry about the
// argument order)
const colorKey = (color1, color2) => color1 < color2 ? color1 + "\t" + color2 : color2 + "\t" + color1;

const colorMix = new Map([
    [colorKey("blue", "red"), "violet"],
    [colorKey("red", "yellow"), "orange"],
    [colorKey("blue", "yellow"), "green"],
]);

// ...

function colorMix (color1, color2){
    const color = colorMix.get(colorKey(color1, color2));
    return color ?? "need to mix two diferent colours";
}

```
Here I'm using bitwise to add the colors, so no matter the order they will always generate a unique ID, with switch I check the color id which would be the sum of the ids of the two colors.

```js
function getColorIndex(color1, color2) {
    const colors = {
        "red": 1,
        "blue": 2,
        "yellow": 4 // next will be the double (n * 2) e.g: "violet": 8
    }

    return color1 !== color2 ? colors[color1] | colors[color2] : -1;
}

function colorMix (color1, color2) {
    switch (getColorIndex(color1, color2)) {
        case 3: // red + blue (1 + 2 === 3)
            return "violet";
        case 5: // red + yellow (1 + 4 === 5)
            return "orange";
        case 6: // blue + yellow (2 + 4 === 6)
            return "green";
        case -1: // getColorIndex will return -1 if colors are equal
            return "need to mix two diferent colours";
        default:
            return `Unrecognized colors: ${color1} + ${color2}`;
    }
}

let myColor = colorMix('blue', 'blue');
console.log(`The color created is: ${ myColor}`);

myColor = colorMix('omg', 'idk');
console.log(`The color created is: ${ myColor}`);

myColor = colorMix('red', 'yellow');
console.log(`The color created is: ${ myColor}`);
```