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";
}

```
Instead of using too much comparisons with a `switch` statement, you could get all colors in an array and sort them, then check with a normalized order.

```js
function colorMix(...colors) {
    colors.sort();
    if (color[0] === 'blue' && color[1] === 'red') return 'violet';
    if (color[0] === 'red' && color[1] === 'yellow') return 'orange';
    if (color[0] === 'blue' && color[1] === 'yellow') return 'green';
    return 'need to mix two diferent colours';
}

```

A different approach with [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)

```js
function colorMix(...colors) {
    const
        mixedColors = {
            violet: new Set(['blue', 'red']),
            orange: new Set(['red', 'yellow'])
            green: new Set(['blue', 'yellow'])
        };

    return Object.keys(mixedColors).find(c => colors.every(Set.prototype.has, mixedColors[c]))
        || 'need to mix two diferent colours';
}

```

And finally one without statemes, just with an accessor

```js
function colorMix(...colors) {
    const mixed = {
        blue: { red: 'violet', yellow: 'green' },
        red: { yellow: 'orange' }
    }
    colors.sort();
    return mixed[colors[0]]?.[colors[1]] ||'need to mix two diferent colours';
}

```