노션 수식 활용법: 수식 코드로 전화번호 지역 번호 분리하는 법

24. 11. 9.

최근에 업무 중에 팀원 전화번호를 정리하고 싶은데, 각각의 번호에서 지역 번호를 어떻게 분리하면 좋을까요?

전화번호의 첫 두 자리를 지역 번호로 분리하려면 아래의 노션 수식 코드를 사용해보세요! 이 코드는 전화번호 속성을 수식으로 처리해서 지역 번호를 쉽게 얻을 수 있습니다.

수식 코드

lets(

len, prop("").length(),

nation, prop("").substring(1,3),

formattedNumber, if(

len = 11,

prop("").substring(0, 3) + "-" + prop("").substring(3, 7) + "-" + prop("").substring(7, 11),

if(

len = 10,

prop("").substring(0, 3) + "-" + prop("").substring(3, 6) + "-" + prop("").substring(6, 10),

prop("")

)

),

if(

nation = "02",

formattedNumber,

if(

nation = "051" or nation = "052" or nation = "053" or nation = "054" or nation = "055" or nation = "061" or nation = "062" or nation = "063" or nation = "064",

formattedNumber,

formattedNumber

)

)

)

간략한 설명

노션 수식 코드 설명

코드 구성 요소

- **lets**: 변수 정의를 위한 함수

- **len**: 전화번호 길이 저장

- **nation**: 국가 코드 저장

주요 기능

- 전화번호의 전체 길이 반환: `len = prop("전화번호").length()`

- 국가 코드 추출: `nation = prop("전화번호").substring(1,3)`

사용 방법

- 변수 선언 후, 필요한 곳에 사용하여 전화번호 정보 처리 가능.