#7  重量単価[初期値]設定(3)―単位換算値を用いて再計算―/Initial Weight Unit Price Estimation (3): Unit Conversion and Recalculation

An English translation of this article is provided at the bottom of the page.

前回の投稿では、各産業の重量単価[初期値]を自動推計するプログラムを作成しました。

推計した重量単価[初期値]の結果を一つずつ目視で確認していきます。問題なく重量単価[初期値]を推計できたワークシートは、タブを緑色に変更します。

また、

  • 検討が必要なワークシートはタブを黄色に
  • 重量単価[初期値]が空欄の(生産単位に一つも[t],[g],[kg]が含まれていない)ワークシートはタブを赤色に

それぞれ変更していきます。

タブが黄色のワークシートの検討・再計算

次に、タブが黄色になったワークシートを一つずつ検討していきます。

分類コード:0621(部門名:砂利・砕石)

生産単位が[千t]という生産品目があったので、それらを推計の対象として、再計算します。

Sub テスト用()
    With Worksheets("0629")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt=2 To 300
            If Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            ElseIf  Range("C" & cnt).Value = "含有量g" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value / 1000000
            End If
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        Range("J2").Value = weightUnitPrice
    End With
End Sub

ワークシートが1つしか登場しないので、With文でまとめてみました。再計算が済んだので、ワークシートのタブの色を緑色に変更します。

分類コード:0629(部門名:その他の鉱物)

生産単位が[含有量g]という生産品目があったので、それを推計対象として、再計算します。

Sub テスト用()
    With Worksheets("0629")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt=2 To 300
            If Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            ElseIf  Range("C" & cnt).Value = "含有量g" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value / 1000000
            End If
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        Range("J2").Value = weightUnitPrice
    End With
End Sub

再計算が済んだので、ワークシートのタブの色を緑色に変更します。

分類コード:2721(部門名:電線・ケーブル)

生産単位が[導体t]という生産品目があったので、それらを推計対象として再計算します。

Sub テスト用()
    With Worksheets("2721")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt=2 To 300
            If Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            ElseIf  Range("C" & cnt).Value = "導体t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            End If
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        Range("J2").Value = weightUnitPrice
    End With
End Sub

再計算が済んだので、ワークシートのタブの色を緑色に変更します。

重量単価[初期値]設定(3)

(3)産業内生産品の生産単位に一つも[t], [g],[kg]が含まれておらず、生産単位が体積である場合、製品の比重を設定することで推計します。各部門とその製品の比重を修士論文から引用します。

分類コード:0611(部門名:石炭・原油・天然ガス)

現状では、ワークシートは以下のようになっています。

重量単価[初期値]は、(1)の方法で算出してあるのですが、算出式には生産単位が[t]の「石炭及び亜炭(精炭)」のみが計上されています。

一方、産単位が[kl]の「原油」と、[千N立法米]の「ガス田ガス・炭田ガス(構造性)」、「ガス田ガス・炭田ガス(水溶性)」が算出式に計上されていません。

なので、先述の単位変換を用いて、原油と天然ガスを含んだ重量単価[初期値]を算出します

Sub テスト用()
    With Worksheets("0611")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt=2 To 300
            If Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            ElseIf  Range("C" & cnt).Value = "kl" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 0.865
            ElseIf  Range("C" & cnt).Value = "千N立方米" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 0.714
            End If
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        Range("J2").Value = weightUnitPrice
    End With
End Sub

再計算が済んだので、ワークシートのタブの色を緑色に変更します。

分類コード:1111(部門名:畜産食料品)

生産額表の一部に、単位が[kl]である乳製品があります。

これらは、先述の単位変換の「飲用牛乳」の値を使って、[t]に変換して、重量単価[初期値]を再計算します。

Sub テスト用()
    With Worksheets("1111")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt=2 To 300
            If Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            End If
            For i=28 To 32
                totalPrice = totalPrice + Range("F" & i).Value
                totalWeight = totalWeight + Range("D" & i).Value * 0.1034
            Next
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        Range("J2").Value = weightUnitPrice
    End With
End Sub

再計算が済んだので、ワークシートのタブの色を緑色に変更します。

分類コード:1129(部門名:その他の飲料)

生産額表は以下のようになっています。

先述の単位変換の「清涼飲料」の単位換算値(1.0t/kl)を用いて、飲料の生産単位を[kl]から[t]に換算して、重量単価[初期値]を再計算します。

Sub テスト用()
    With Worksheets("1129")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt=2 To 300
            If Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            ElseIf Range("C" & cnt).Value = "kl" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 1.0
            End If
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        Range("J2").Value = weightUnitPrice
    End With
End Sub

再計算が済んだので、ワークシートのタブの色を緑色に変更します。

分類コード:2111(部門名:石油製品)

上述の単位変換の表での「石油製品」の単位換算値(0.865[t/kl])を用いて、「ガソリン」・「ジェット燃料油」・「灯油」・「軽油」・「A重油」・「B・C重油」の生産単位を[t]に換算して、重量単価[初期値]を再計算します。

Sub テスト用()
    With Worksheets("2111")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt=2 To 300
            If Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            ElseIf Range("B" & cnt).Value Like "*ガソリン*" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 0.865
            ElseIf Range("B" & cnt).Value Like "*ジェット*" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 0.865
            ElseIf Range("B" & cnt).Value Like "*灯油*" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 0.865
            ElseIf Range("B" & cnt).Value Like "*軽油*" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 0.865
            ElseIf Range("B" & cnt).Value Like "*重油*" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 0.865
            End If
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        Range("J2").Value = weightUnitPrice
    End With
End Sub

再計算が済んだので、ワークシートのタブの色を緑色に変更します。

分類コード:2521(部門名:セメント・セメント製品)

上述の単位変換の表の、「生コンクリート」の単位換算値を用いて、重量単価[初期値]を再計算します。

Sub テスト用()
    With Worksheets("2521")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt=2 To 300
            If Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value
            ElseIf Range("B" & cnt).Value = "生コンクリート" Then
                totalPrice = totalPrice + Range("F" & cnt).Value
                totalWeight = totalWeight + Range("D" & cnt).Value * 1.5
            End If
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        Range("J2").Value = weightUnitPrice
    End With
End Sub

再計算が済んだので、ワークシートのタブの色を緑色に変更します。

English Translation Part

In my previous post, I created a program to automatically estimate the initial weight unit price for each industry.

Now, I am visually inspecting the results of these estimated initial values one by one. For worksheets where the estimation was completed without issues, I am changing the tab color to green.

Additionally:

  • For worksheets that require further review, I change the tab color to yellow.
  • For worksheets where the initial weight unit price is blank (meaning no production units were listed in [t], [g], or [kg]), I change the tab color to red.

Reviewing and Recalculating "Yellow Tab" Worksheets

Next, I am examining the yellow-tabbed worksheets one by one.

Sector Code: 0621 (Gravel and Quarrying)

Since there were production items with the unit "1,000t," I included them in the estimation and recalculated.

Sector Code: 0629 (Other Non-metallic Ores)

There was an item with the unit "g content." I included this in the estimation and recalculated.

Sub Test()
    With Worksheets("0629")
        Dim weightUnitPrice As Double
        Dim totalWeight As Double
        Dim totalPrice As Double
        For cnt = 2 To 300
            If .Range("C" & cnt).Value = "t" Then
                totalPrice = totalPrice + .Range("F" & cnt).Value
                totalWeight = totalWeight + .Range("D" & cnt).Value
            ElseIf .Range("C" & cnt).Value = "g content" Then
                totalPrice = totalPrice + .Range("F" & cnt).Value
                totalWeight = totalWeight + .Range("D" & cnt).Value / 1000000
            End If
        Next
        weightUnitPrice = totalPrice * 1000000 / totalWeight
        .Range("J2").Value = weightUnitPrice
    End With
End Sub

Note: Since I'm only dealing with one worksheet at a time, I used a With statement to keep the code concise. After recalculating, I changed the tab color to green.

Sector Code: 2721 (Electric Wires and Cables)

I found items with the unit "conductor t" and recalculated accordingly.


Setting Initial Weight Unit Price: Method (3)

(3) When no units are in [t], [g], or [kg], and the production unit is based on volume:
In these cases, I estimate the weight by applying the specific gravity of the products. I am referencing the specific gravity values for each sector and product from my Master’s thesis.

Sector Code: 0611 (Coal, Crude Petroleum, and Natural Gas)

The current worksheet looks like this:

Currently, the initial weight unit price is calculated using Method (1), but only "Coal and Lignite" (unit: [t]) is included in the calculation. Meanwhile, "Crude Oil" (unit: [kl]) and "Natural Gas" (unit: [1,000 N m3]) are missing.

Using the unit conversion mentioned above, I recalculated the initial weight unit price to include crude oil and natural gas.

' Unit conversion: Crude oil (0.865 t/kl), Natural gas (0.714 t/1,000 Nm3)

Sector Code: 1111 (Livestock Products)

Some dairy products are listed in [kl]. I converted these to [t] using the conversion factor for "Drinking Milk" (0.1034 t/kl) and recalculated the unit price.

Sector Code: 1129 (Other Beverages)

Using the conversion factor for "Soft Drinks" (1.0 t/kl), I converted the beverage units from [kl] to [t] and recalculated.

Sector Code: 2111 (Petroleum Products)

Using the factor for "Petroleum Products" (0.865 t/kl), I converted "Gasoline," "Jet Fuel," "Kerosene," "Light Oil," and "Heavy Fuel Oil" into [t] and recalculated.

Sector Code: 2521 (Cement and Cement Products)

I recalculated the initial weight unit price using the conversion factor for "Ready-mixed Concrete" (1.5 t/m3).


Follow me!

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です