# Array like syntax in MS Excel

How can I select a cell making use of like in the majority of shows languages - a [x ]?

That is, I do not recognize which row is information I desire yet I recognize the column. This example can possibly serve in recognition solutions like adhering to

= IF(A[row()] = "X", TRUE, FALSE)

Here are two more options for you:

### Turn on the R1C1 reference style

In Excel 2003 for example:

- Click Options on the Tools menu, then click the General tab.
- Under Settings, select the R1C1 reference style check box.

Then in your formula, you would just do this:

```
=R1 = "X"
```

which will automatically return a true or a false. Please note that in your formulas, any time you use If() to return true and false, you can just get rid of the If() entirely as any comparison already returns a boolean value.

Unfortunately, with this method, you can't use the A1 reference style, so this trick may be of limited utility for you.

### Use named ranges

Named ranges really are powerful, and they are easy to use. Let's say you've labeled the column with the X's in it Flag. So you would select the entire column and select Insert -> Name -> Define. Give it the name Flag (if it hasn't already found it based on your label) and then in formulas you use the word **Flag** as if it was a cell reference, like so:

```
=Flag = "X"
```

This will use the value from the same row, but the correct column.

In addition to manually defining names, if you want to add labels to a whole set of data at once, select your data range, then choose Insert -> Names -> Create, and choose the position of the labels (usually **Top Row** for me). Now you've defined a named range for every column in your spreadsheet and you can begin using those in your formulas.

### One more tidbit

Don't miss out on the intersect operator, which is a space. The union operator is a comma as in `=Sum(A1, B1)`

and the intersect operator is similarly used like this `=Sum(Flag 2:10)`

. If the named range *Flag* referred to column 1 for example, then this would address the range A2:A10, the intersection of the two listed ranges. You can use many intersections one after the other as in `range range range range`

. `A:A 1:1`

resolves to the same reference as `A1`

.

If your row data is also labeled meaningfully, as in regions or years or other values, then adding named ranges and using the intersect operator can do some wonderful things, such as, if the named range *TotalSales* refers to a column with sales amounts in it, and the named range *California* refers to all the (entire) rows with California's data—not necessarily contiguous—then the formula `=Sum(TotalSales California1)`

would be the sum of the intersection of those two.

I concur, INDEX is most definitely a far better response to this than INDIRECT, actually it actually is the closest point to an array component selector that exists in Excel. (NB: there is no component absolutely no as there remains in several shows languages, Excel works with rows and also columns, so the first one is constantly 1 in either instructions)

Note that you can make use of the straightforward variation to select the umpteenth component in a one column array:

= INDEX (A1: A100,27) would certainly offer the 27th component of A1: A100, ie A27 or a one - row array:

= INDEX (A1: G1,,5) offers the web content of the collaborators of enemy in the array, so E1 in this instance (note the double comma to show no value for the row is given)

you can do 2 - dimensional selections:

= INDEX (A1: D100,27,4) would certainly be the materials of D27 (row 27, column 4 of the array) and also

= INDEX (C19: X43,5,7) offers I23

Now, if you have a 2 - dimensional array and also just offer one parameter, the outcome will certainly be an entire column or row. While this makes no sens on it is very own, it is great ingrained within an additional function. So: = INDEX (A1: C5,1) - returns a #REF mistake as it does not also recognize whether the 1 describes the row or the column.

= INDEX (A1: C5,1,) - returns #VALUE due to the fact that it can not present the resultant arrary in a cell, yet keep in mind that the added comma is currently clearly specifying that the 1 suggests the first row.

= SUM (INDEX (A1: C5,1,)) - returns the amount of all the values in A1: C1, the first row of the array.

Nonetheless, having claimed all that, you might not require to clearly select an array component in all. It appears from your instance that you are attempting to examine the value in a well-known column for the very same row as the formula has actually been gone into in. You can do this making use of the *implied * junction of the array and also the existing row, so as an example, if you enter this formula in cell B13:

= IF (A: A = "X", "Yes this works", "X not found") after that you can replicate this to any kind of various other row merely by dragging it out and also on each row it unconditionally suggests "the component of column A which gets on the very same row number as this formula". Keep in mind: the array does not need to be an entire column, maybe A4: A104, or perhaps on an additional sheet, yet in every instance it will certainly make use of the cell in the very same real Excel row as the formula. I'll claim that last little bit once more: If you have the formula in cell B5 making use of an array A4: A104 you will certainly not get the 5th component of that array (A8) yet instead cell A5. If you make use of the formula in cell B3 versus A4: A104 you get a mistake due to the fact that the array does not have anything on row 3 (there is no junction). So, if your rows are aligned, this implied cell from an array is actually valuable (and also also cleaner when you make use of a called array for the column), yet if they are not, you require INDEX to get a real duplication of a [n] for any kind of component of the array.

If you recognize the array that the values remain in usage the INDEX function.

as an example

```
= IF(INDEX(A:A, ROW()) = "X", TRUE, FALSE)
```

Unlike the INDIRECT function it is not unpredictable and also will certainly therefore not be recalculated whenever anything adjustments.

Related questions