スポンサードリンク | |
B | C | D | E | |
2 | 商品 | 上半期 | 下半期 | 年間販売数 |
3 | りんご | 5,800 | 2,790 | |
4 | みかん | 4,580 | 4,680 | |
5 | バナナ | 7,540 | 7,720 |
B | C | D | E | |
2 | 商品 | 年間販売目標 | 上半期販売実績 | 下半期販売目標 |
3 | りんご | 9,000 | 4,870 | |
4 | みかん | 7,000 | 3,560 | |
5 | バナナ | 8,000 | 4,720 |
B | C | D | E | |
2 | 商品 | 販売数 | 単価 | 金額 |
3 | りんご | 750 | 120 | |
4 | みかん | 648 | 220 | |
5 | バナナ | 877 | 189 |
B | C | D | E | |
2 | 商品 | 上半期 | 下半期 | 増減率 |
3 | りんご | 5,800 | 2,790 | |
4 | みかん | 4,580 | 4,680 | |
5 | バナナ | 7,540 | 7,720 |
B | C | D | E | F | |
2 | 商品 | 上半期 | 下半期 | 年間販売数 | 販売比率 |
3 | りんご | 5,800 | 2,790 | 8,590 | |
4 | みかん | 4,580 | 4,680 | 9,260 | |
5 | バナナ | 7,540 | 7,720 | 15,260 | |
6 | 合計 | 17,920 | 15,190 | 33,110 |
B | C | D | E | |
2 | 商品 | 上半期 | 下半期 | 年間販売数 |
3 | りんご | 5,800 | 2,790 | 8,590 |
4 | みかん | 4,580 | 4,680 | 9,260 |
5 | バナナ | 7,540 | 7,720 | 15,260 |
Sub ex_01() Dim i As Long For i = 3 To 5 Cells(i, 5).Value = Cells(i, 3).Value + Cells(i, 4).Value Cells(i, 5).NumberFormatLocal = "#,##0" Next i End Sub |
B | C | D | E | |
2 | ||||
3 | x(1, 1) | x(1, 2) | ||
4 | x(2, 1) | x(2, 2) | ||
5 | x(3, 1) | x(3, 2) |
Sub ex_01a() Dim i As Long Dim x As Variant Dim ans As Variant x = Range("C3:D5").Value ReDim ans(1 To UBound(x), 1 To 1) For i = LBound(x) To UBound(x) ans(i, 1) = x(i, 1) + x(i, 2) Next i With Range("E3").Resize(UBound(x)) .Value = ans .NumberFormatLocal = "#,##0" End With End Sub |
B | C | D | E | |
2 | 商品 | 年間販売目標 | 上半期販売実績 | 下半期販売目標 |
3 | りんご | 9,000 | 4,870 | 4,130 |
4 | みかん | 7,000 | 3,560 | 3,440 |
5 | バナナ | 8,000 | 4,720 | 3,280 |
Sub ex_02() Dim i As Long For i = 3 To 5 Cells(i, 5).Value = Cells(i, 3).Value - Cells(i, 4).Value Cells(i, 5).NumberFormatLocal = "#,##0" Next i End Sub |
Sub ex_02a() Dim i As Long Dim x As Variant Dim ans As Variant x = Range("C3:D5").Value ReDim ans(1 To UBound(x), 1 To 1) For i = LBound(x) To UBound(x) ans(i, 1) = x(i, 1) - x(i, 2) Next i With Range("E3").Resize(UBound(x)) .Value = ans .NumberFormatLocal = "#,##0" End With End Sub |
B | C | D | E | |
2 | 商品 | 販売数 | 単価 | 金額 |
3 | りんご | 750 | 120 | 90,000 |
4 | みかん | 648 | 220 | 142,560 |
5 | バナナ | 877 | 189 | 165,753 |
Sub ex_03() Dim i As Long For i = 3 To 5 Cells(i, 5).Value = Cells(i, 3).Value * Cells(i, 4).Value Cells(i, 5).NumberFormatLocal = "#,##0" Next i End Sub |
Sub ex_03a() Dim i As Long Dim x As Variant Dim ans As Variant x = Range("C3:D5").Value ReDim ans(1 To UBound(x), 1 To 1) For i = LBound(x) To UBound(x) ans(i, 1) = x(i, 1) * x(i, 2) Next i With Range("E3").Resize(UBound(x)) .Value = ans .NumberFormatLocal = "#,##0" End With End Sub |
B | C | D | E | |
2 | 商品 | 上半期 | 下半期 | 増減率 |
3 | りんご | 5,800 | 2,790 | 48% |
4 | みかん | 4,580 | 4,680 | 102% |
5 | バナナ | 7,540 | 7,720 | 102% |
Sub ex_04() Dim i As Long For i = 3 To 5 Cells(i, 5).Value = Cells(i, 4).Value / Cells(i, 3).Value Cells(i, 5).NumberFormatLocal = "0%" Next i End Sub |
Sub ex_04a() Dim i As Long Dim x As Variant Dim ans As Variant x = Range("C3:D5").Value ReDim ans(1 To UBound(x), 1 To 1) For i = LBound(x) To UBound(x) ans(i, 1) = x(i, 2) / x(i, 1) Next i With Range("E3").Resize(UBound(x)) .Value = ans .NumberFormatLocal = "0%" End With End Sub |
B | C | D | E | F | |
2 | 商品 | 上半期 | 下半期 | 年間販売数 | 販売比率 |
3 | りんご | 5,800 | 2,790 | 8,590 | 26% |
4 | みかん | 4,580 | 4,680 | 9,260 | 28% |
5 | バナナ | 7,540 | 7,720 | 15,260 | 46% |
6 | 合計 | 17,920 | 15,190 | 33,110 |
Sub ex_05() Dim i As Long For i = 3 To 5 Cells(i, 6).Value = Cells(i, 5).Value / Cells(6, 5).Value Cells(i, 6).NumberFormatLocal = "0%" Next i End Sub |
Sub ex_05a() Dim i As Long Dim x As Variant Dim ans As Variant x = Range("E3:E6").Value ReDim ans(1 To UBound(x), 1 To 1) For i = LBound(x) To UBound(x) - 1 ans(i, 1) = x(i, 1) / x(UBound(x), 1) Next i With Range("F3").Resize(UBound(x)) .Value = ans .NumberFormatLocal = "0%" End With End Sub |
スポンサードリンク
PageViewCounter
Since2006/2/27