0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

EXCELで使える関数のスニペット(基本編)

Last updated at Posted at 2021-03-07

はじめに

EXCELを使ってて頻繁に使う関数の記述を備忘録として記載。

本編

形式を揃えるための処理

数値に変換する

=VALEU(B1)

A1の内容をVALUE()関数で処理する。
image.png
A1の文字列が数字になる。
image.png

どのような時に使うか?

  • CSVから取り込んだ社員IDが「012345」となったり「12345」となったりする場合があって揃えたい。

    EXCELで「012345」=「12345」はFALSEです。「12345」=[12345」になるように整えます。

位置を取得するための処理

行番号の取得

=ROW()

image.png

列番号の取得

=COLUMN()

image.png

アドレスの取得

=ADDRESS(ROW(), COLUMN())

image.png

列名(英語表記)の取得

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(ADDRESS(ROW(),COLUMN(),4,1),"$",""),"0",""),"1",""),"2",""),"3",""),"4",""),"5",""),"6",""),"7",""),"8",""),"9","")

image.png

解説:
ADDRESS()で取得した$A$1形式の文字列から$と数字を除くという処理をしています。
正規表現が使えればスマートな記述が可能なのですが、正規表現を使う方法が見当たらなかったため、SUBSTITUTE()を何度も使って文字列を置換して処理しています。

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?