# LET

## Content

이 함수는 계산 결과에 이름을 지정하는 데 사용됩니다. 변수 이름을 LET() 함수의 중괄호 내에서 중간 계산값, 값 저장 또는 이름 정의에 활용할 수 있습니다. 이 함수를 사용하려면 이름과 값 쌍을 정의하고, 이들 모두를 사용하는 계산식을 작성해야 합니다.
이 함수를 이용하면 특정 범위나 셀 참조가 무엇을 의미하는지 기억할 필요 없이, 계산이 어떤 역할을 하는지 이해하기 쉽고, 동일한 식을 반복해서 복사 붙여넣기 하지 않아도 됩니다.

## 구문

`LET(name1, name_value1, calculation_or_name2, [name_value2, calculation_or_name3...])`

## 인수

| 인수 | 설명 |
| --- | --- |
| *name* | 할당할 첫 번째 이름입니다. 항상 문자로 시작해야 하며 '.' 문자를 포함해서는 안 됩니다. |
| *name\_value1* | *name1*에 할당할 값입니다. |
| *calculation\_or\_name2* | 다음 중 하나를 정의할 수 있습니다.<ul><li>LET 함수 내의 모든 이름을 사용하는 계산식 (항상 마지막 인수여야 함)</li><li>두 번째 이름, 이 경우 name\_value2와 calculation\_or\_name3도 필요</li></ul> |
| *name\_value2* | [선택] *calculation\_or\_name2*에 할당할 값 또는 계산식 |
| *calculation\_or\_name3* | [선택] 다음 중 하나를 정의할 수 있습니다.<ul><li>LET 함수 내의 모든 이름을 사용하는 계산식 (항상 마지막 인수여야 함)</li><li>세 번째 이름, 이 경우 name\_value3와 calculation\_or\_name4도 필요</li></ul> |

## 데이터 유형

반환값의 데이터 유형은 다양합니다.

## 설명

마지막 인수는 항상 결과를 반환하는 계산식이어야 합니다.

## 예제

기본 사용법:

```JavaScript
var formula = '=LET(x,2,x+3)';
sheet1.setValue(2, 0, 'Pair variable');
sheet1.setValue(2, 1, formula);
sheet1.setValue(3, 0, 'Result');
sheet1.setFormula(3, 1, formula);
```

LET 지역 변수와 사용자 정의 이름 사용 예:

```JavaScript
sheet1.addCustomName('user', '="Michael"');

var formula = '=LET(user,"Ivy","The actual user is: "&user)';
sheet1.setValue(2, 0, 'Always use LET local variable first');
sheet1.setValue(2, 1, formula);
sheet1.setValue(3, 0, 'Result');
sheet1.setFormula(3, 1, formula);

// 지역 변수가 없을 때 사용자 정의 이름 사용
var formula = '=LET(user,user,"The actual user is: "&user)';
sheet1.setValue(5, 0, 'Use custom name if local variable is not available');
sheet1.setValue(5, 1, formula);
sheet1.setValue(6, 0, 'Result');
sheet1.setFormula(6, 1, formula);
```

> **참고:** 이름 인수에는 '.' 문자를 포함하면 안 되며, 이는 Excel 최신 버전 동작과 일치하도록 업데이트되었습니다. 자세한 내용은 [버전 14.1.0 릴리즈 노트](/spreadjs/docs/rnotes/rnotesv141)를 참고하세요.