VBA

Private Sub kat()
Application.ScreenUpdating = False 'VBAの速度を早くする

Dim i
With Sheets("データ追加") 'セルのシート一括指定

For i = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row

.Cells(i, 6) = Left(.Cells(i, 1), 4) 'A列の左から4文字を抽出

.Cells(i, 7) = WorksheetFunction.VLookup( _
.Cells(i, 2), Sheets("マスタ").Range("A:B"), 2, 0) 'VLookupで支社名を入力
If .Cells(i, 5) >= 500000 Then '500000以上の条件分岐
.Cells(i, 8) = "A"
Else
.Cells(i, 8) = "B"
End If
Next
End With
End Sub