フォーラムでは、時々、頭の体操(Educational Brain Teaser)が出題されるのですが、私も始めて作ってみました。
- ちょっとややこしい、テーブルフォーマットのリクエストです。
- 簡単かも知れないし、簡単じゃないかも知れないです。
- 解答にトライしても、ネタバレに なるので、ここにはファイルはつけないで下さい。スクショのみ。
- こんなアプローチで、いくんですか?!ってくらいのコメントはOKかと思います。
- 1週間後くらいに、解説載せます。
- 今回は、データの複製はなるだけ使いません。
- ちなみに、とくに何も出ません。
- (後出しで申し訳ない:2/1 追記)できれば、データベースの加工なしで。。(できれば Join、Union、Pivotなどなしで)
Data set. (Excel Attached)
Shop sizeShopSalesProfitBigShop A 125,000 21,054MediumShop B 98,200 20,031SmallShop C 48,500 12,498BigShop D 154,200 24,500MediumShop E 126,510 22,004SmallShop F 35,621 10,400BigShop G 210,000 24,500MediumShop H 106,540 18,540SmallShop J 9,800 2,540
Target View
(追記:01/31 以下の2つの表は、同じワークシート内に同時に存在する訳ではなく、階層で切り替えられるのをイメージしています。
それと、最初のPostで、色設定間違ってました。)
Color Criteria
[Sales]
if min([Shop size])="Big" then
if avg([Sales])>250000 then "Green"
elseif avg([Sales])>200000 then "Yellow"
else "Red" end
elseif min([Shop size])="Medium" then
if avg([Sales])>150000 then "Green"
elseif avg([Sales])>100000 then "Yellow"
else "Red" end
elseif min([Shop size])="Small" then
if avg([Sales])>100000 then "Green"
elseif avg([Sales])>500000 then "Yellow"
else "Red" end
end
[Profit]
if min([Shop size])="Big" then
if avg([Profit])>25000 then "Green"
elseif avg([Profit])>20000 then "Yellow"
else "Red" end
elseif min([Shop size])="Medium" then
if avg([Profit])>20000 then "Green"
elseif avg([Profit])>15000 then "Yellow"
else "Red" end
elseif min([Shop size])="Small" then
if avg([Profit])>15000 then "Green"
elseif avg([Profit])>10000 then "Yellow"
else "Red" end
end
[Ratio]
if min([Shop size])="Big" then
if sum([Profit])/sum([Sales])>0.15 then "Green"
elseif sum([Profit])/sum([Sales])>0.1 then "Yellow"
else "Red" end
elseif min([Shop size])="Medium" then
if sum([Profit])/sum([Sales])>0.2 then "Green"
elseif sum([Profit])/sum([Sales])>0.15 then "Yellow"
else "Red" end
elseif min([Shop size])="Small" then
if sum([Profit])/sum([Sales])>0.25 then "Green"
elseif sum([Profit])/sum([Sales])>0.2 then "Yellow"
else "Red" end
end
Thanks,
Shin
Shinさん
チャレンジしてみました。
一応見た目はできたように思えますがかなり力技な手順を踏んでいるので
他のアプローチはあるんだろうな、と思っています。
解答楽しみにしています!
Nakajima