This can be done with a formula, but it's rather long, and VBA is probably a better solution. Also, this won't handle the possible case where you have *three* values > 7. But I'll show you the formula method anyway.

Let's start out with the simpler case where there is only one cell > 7:

The formula in F1 is:

```
=IF(COUNTIF($A$1:D$1,">7")>1,"Double",IF($A1>7,"U",IF($B1>7,"X",IF($C1>7,"Y",IF($D1>7,"Z","")))))
```

The COUNTIF() portion counts the number of cells in the range A1:D1 that are greater than 7. If that total is greater than 1, the IF() returns "Double", which is just a placeholder for the bigger formula that comes later. If the total is not greater than 1, the formula uses your nested IF() statement to display the code for the cell that is > 7.

For the case where two cells are > 7, a nested IF() won't work. We need to know which columns are > 7. If we have this data,

First, we build an array that lists the columns > 7. This expression
`(A1:D1>7)*COLUMN(A1:D1)`

does that.
The first part `(A1:D1>7)`

asks which cells are > 7 and evaluates to the array {TRUE,FALSE,TRUE,FALSE}. The second part is the column numbers of A1:D1 or {1,2,3,4}. Multiplying these two arrays causes the logical values TRUE and FALSE to convert to 1 and 0, so the result is the array {1,0,3,0} which are the column numbers that have a value > 7.

Now we can use these numbers to lookup the column codes using INDEX():

```
INDEX({"U","X","Y","Z"},LARGE((A1:D1>7)*COLUMN(A1:D1),2))
```

Here LARGE() returns the second largest value in the array of column numbers > 7 (which is 1), and INDEX() uses that to return the first element in the array of letters - U.

Similarly, this expression gets the codes corresponding to the second and first largest column numbers separated by a comma:

```
INDEX({"U","X","Y","Z"},LARGE((A1:D1>7)*COLUMN(A1:D1),2))&","&INDEX({"U","X","Y","Z"},LARGE((A1:D1>7)*COLUMN(A1:D1),1)
```

Now we substitute all of that into the first equation above, replacing "Double". This formula in F1 is an array formula and must be entered with `Ctrl``Shift``Enter`

```
=IF(COUNTIF($A$1:D$1,">7")>1,INDEX({"U","X","Y","Z"},LARGE((A1:D1>7)*COLUMN(A1:D1),2))&","&INDEX({"U","X","Y","Z"},LARGE((A1:D1>7)*COLUMN(A1:D1),1)),IF($A1>7,"U",IF($B1>7,"X",IF($C1>7,"Y",IF($D1>7,"Z","")))))
```

I told you this formula was going to be "rather long". I hope this helps.