注意:相当于$ C $ 1的那些文本是一个下拉列表。
=IF(
$C$1="", "", IF(
$C$1="AGLAYAN 1", T4, IF(
$C$1="AGLAYAN 2", AI4, IF(
$C$1="ALABEL", AX4, IF(
$C$1="BABAK 1",BM4,IF($C$1="BABAK 2",CB4,IF($C$1="BANAYBANAY",CQ4,IF($C$1="BANGA",DF4,IF($C$1="BANSALAN",DU4,IF($C$1="BANSALAN 2",EJ4,IF($C$1="BANSALAN 3",EY4,IF($C$1="BAROBO",FN4,IF($C$1="BATOBATO",GC4,IF($C$1="BAYUGAN",GR4,IF($C$1="BUHANGIN",HG4,IF($C$1="CALINAN",HV4,IF($C$1="CARMEN",IK4,IF($C$1="COMPOSTELA 1",IZ4,IF($C$1="COMPOSTELA 2",JO4,IF($C$1="CUGMAN",KD4,IF($C$1="DIGOS 1",KS4,IF($C$1="DIGOS 2",LH4,IF($C$1="DIGOS 3",LW4,IF($C$1="DON CARLOS 1",ML4,IF($C$1="ESPERANZA 1",NA4,IF($C$1="ESPERANZA 2",NP4,IF($C$1="ESPERANZA 3",OE4,IF($C$1="GENSAN",OT4,IF($C$1="HAGONOY",PI4,IF($C$1="HINATUAN",PX4,IF($C$1="ISULAN 1",QM4,IF($C$1="KABAKAN 1",RB4,IF($C$1="KABAKAN 2",RQ4,IF($C$1="KALILANGAN",SF4,IF($C$1="KAPALONG",SU4,IF($C$1="KIDAPAWAN 2",TJ4,IF($C$1="KIDAPAWAN 3",TY4,IF($C$1="KIDAPAWAN 4",UN4,IF($C$1="KIDAPAWAN 5",VC4,IF($C$1="KIDAPAWAN 6",VR4,IF($C$1="KIDAPAWAN 7",WG4,IF($C$1="KIDAPAWAN 8",WV4,IF($C$1="KRINKLES 1",XK4,IF($C$1="KRINKLES 2",XZ4,IF($C$1="LUPON 1",YO4,IF($C$1="LUPON 2",ZD4,IF($C$1="MAASIM",ZS4,IF($C$1="MAGPET",AAH4,IF($C$1="MAGSAYSAY",AAW4,IF($C$1="MAITUM",ABL4,IF($C$1="MAKILALA",ACA4,IF($C$1="MALAYBALAY",ACP4,IF($C$1="MALITA",ADE4,IF($C$1="MANGAGOY",ADT4,IF($C$1="MARAMAG 1",AEI4,IF($C$1="MARAMAG 2",AEX4,IF($C$1="MARBEL 1",AFM4,IF($C$1="MARBEL 2",AGB4,IF($C$1="MARIKIT",AGQ4,IF($C$1="MATALAM",AHF4,IF($C$1="MATANAO",AHU4,IF($C$1="MIDSAYAP",AIJ4,IF($C$1="MLANG",AIY4,IF($C$1="MONKAYO",AJN4,IF($C$1="NABUNTURAN 1",AKC4,IF($C$1="NABUNTURAN 2",AKR4,IF($C$1="NABUNTURAN 3",AKG4,IF($C$1="OZAMIZ",ALV4,IF($C$1="PADADA",AMK4,IF($C$1="PANABO 2",AMZ4,IF($C$1="PANABO 3",ANO4,IF($C$1="PANABO 5",AOD4,IF($C$1="PANABO MAIN",AOS4,IF($C$1="PANABO PDP 1",APH4,IF($C$1="PANABO PDP 2",APW4,IF($C$1="PANTUKAN",AQL4,IF($C$1="PEÑAPLATA",ARA4,IF($C$1="PIGKAWAYAN",ARP4,IF($C$1="POLOMOLOK 1",ASE4,IF($C$1="POLOMOLOK 2",AST4,IF($C$1="PUERTO",ATI4,IF($C$1="QUEZON",ATX4,IF($C$1="SAN FRANCISCO 1",AUM4,IF($C$1="STA. MARIA",AVB4,IF($C$1="STO NIÑO",AVQ4,IF($C$1="STO. TOMAS",AWF4,IF($C$1="SULOP",AWU4,IF($C$1="SURIGAO 2",AXJ4,IF($C$1="TACORONG 1",AXY4,IF($C$1="TACORONG 2",AYN4,IF($C$1="TAGBINA",AZC4,IF($C$1="TAGUM 4",AZR4,IF($C$1="TIBUNGCO 1",BAG4,IF($C$1="TIBUNGCO 2",BAV4,IF($C$1="TORIL 1",BBK4,IF($C$1="TORIL 2",BBZ4,IF($C$1="TRENTO",BCO4,IF($C$1="TULUNAN",BDD4,IF($C$1="TUPI",BDS4,""))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
)
)
)
)
)
答案 0 :(得分:-1)
请尝试以下方法......
首先,调出Worksheet_Change事件的VBA代码。要执行此操作,请单击工作表中的某个位置。选择Developer
菜单。选择Design Mode
。选择View Code
。
接下来,粘贴以下代码......
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$1" Then
Select Case $C$1
Case "AGLAYAN 1"
Range( "E4:S19" ).Value = Range( "T4:AH19" ).Value
Case "AGLAYAN 2"
Range( "E4:S19" ).Value = Range( "AI4:AW19" ).Value
Case "ALABEL",
Range( "E4:S19" ).Value = Range( "AX4:BL19" ).Value
Case "BABAK 1",
Range( "E4:S19" ).Value = Range( "BM4:CA19" ).Value
Case "BABAK 2",
Range( "E4:S19" ).Value = Range( "CB4:CP19" ).Value
Case "BANAYBANAY",
Range( "E4:S19" ).Value = Range( "CQ4:DE19" ).Value
Case "BANGA",
Range( "E4:S19" ).Value = Range( "DF4:DT19" ).Value
Case "BANSALAN",
Range( "E4:S19" ).Value = Range( "DU4:EI19" ).Value
Case "BANSALAN 2",
Range( "E4:S19" ).Value = Range( "EJ4:EX19" ).Value
Case "BANSALAN 3",
Range( "E4:S19" ).Value = Range( "EY4:FM19" ).Value
Case "BAROBO",
Range( "E4:S19" ).Value = Range( "FN4:GB19" ).Value
Case "BATOBATO",
Range( "E4:S19" ).Value = Range( "GC4:GQ19" ).Value
Case "BAYUGAN",
Range( "E4:S19" ).Value = Range( "GR4:HF19" ).Value
Case "BUHANGIN", HG4,
Range( "E4:S19" ).Value = Range( "HG4:HU19" ).Value
Case "CALINAN",
Range( "E4:S19" ).Value = Range( "HV4:IJ19" ).Value
Case "CARMEN",
Range( "E4:S19" ).Value = Range( "IK4:IY19" ).Value
Case "COMPOSTELA 1",
Range( "E4:S19" ).Value = Range( "IZ4:JN19" ).Value
Case "COMPOSTELA 2",
Range( "E4:S19" ).Value = Range( "JO4:KC19" ).Value
Case "CUGMAN",
Range( "E4:S19" ).Value = Range( "KD4:KR19" ).Value
Case "DIGOS 1",
Range( "E4:S19" ).Value = Range( "KS4:LG19" ).Value
Case "DIGOS 2",
Range( "E4:S19" ).Value = Range( "LH4:LV19" ).Value
Case "DIGOS 3",
Range( "E4:S19" ).Value = Range( "LW4:MK19" ).Value
Case "DON CARLOS 1",
Range( "E4:S19" ).Value = Range( "ML4:MZ19" ).Value
Case "ESPERANZA 1",
Range( "E4:S19" ).Value = Range( "NA4:NO19" ).Value
Case "ESPERANZA 2",
Range( "E4:S19" ).Value = Range( "NP4:OD19" ).Value
Case "ESPERANZA 3",
Range( "E4:S19" ).Value = Range( "OE4:OS19" ).Value
Case "GENSAN",
Range( "E4:S19" ).Value = Range( "OT4:PH19" ).Value
Case "HAGONOY",
Range( "E4:S19" ).Value = Range( "PI4:PW19" ).Value
Case "HINATUAN",
Range( "E4:S19" ).Value = Range( "PX4:QL19" ).Value
Case "ISULAN 1",
Range( "E4:S19" ).Value = Range( "QM4:RA19" ).Value
Case "KABAKAN 1",
Range( "E4:S19" ).Value = Range( "RB4:RP19" ).Value
Case "KABAKAN 2",
Range( "E4:S19" ).Value = Range( "RQ4:SE19" ).Value
Case "KALILANGAN",
Range( "E4:S19" ).Value = Range( "SF4:ST19" ).Value
Case "KAPALONG",
Range( "E4:S19" ).Value = Range( "SU4:TI19" ).Value
Case "KIDAPAWAN 2",
Range( "E4:S19" ).Value = Range( "TJ4:TX19" ).Value
Case "KIDAPAWAN 3",
Range( "E4:S19" ).Value = Range( "TY4:UM19" ).Value
Case "KIDAPAWAN 4",
Range( "E4:S19" ).Value = Range( "UN4:VB19" ).Value
Case "KIDAPAWAN 5",
Range( "E4:S19" ).Value = Range( "VC4:VQ19" ).Value
Case "KIDAPAWAN 6",
Range( "E4:S19" ).Value = Range( "VR4:WF19" ).Value
Case "KIDAPAWAN 7",
Range( "E4:S19" ).Value = Range( "WG4:WU19" ).Value
Case "KIDAPAWAN 8",
Range( "E4:S19" ).Value = Range( "WV4:XJ19" ).Value
Case "KRINKLES 1",
Range( "E4:S19" ).Value = Range( "XK4:XY19" ).Value
Case "KRINKLES 2",
Range( "E4:S19" ).Value = Range( "XZ4:YN19" ).Value
Case "LUPON 1",
Range( "E4:S19" ).Value = Range( "YO4:ZC19" ).Value
Case "LUPON 2",
Range( "E4:S19" ).Value = Range( "ZD4:ZR19" ).Value
Case "MAASIM",
Range( "E4:S19" ).Value = Range( "ZS4:AAG19" ).Value
Case "MAGPET",
Range( "E4:S19" ).Value = Range( "AAH4:AAV19" ).Value
Case "MAGSAYSAY",
Range( "E4:S19" ).Value = Range( "AAW4:ABK19" ).Value
Case "MAITUM",
Range( "E4:S19" ).Value = Range( "ABL4:ABZ19" ).Value
Case "MAKILALA",
Range( "E4:S19" ).Value = Range( "ACA4:ACO19" ).Value
Case "MALAYBALAY",
Range( "E4:S19" ).Value = Range( "ACP4:ADD19" ).Value
Case "MALITA",
Range( "E4:S19" ).Value = Range( "ADE4:ADS19" ).Value
Case "MANGAGOY",
Range( "E4:S19" ).Value = Range( "ADT4:AEH19" ).Value
Case "MARAMAG 1",
Range( "E4:S19" ).Value = Range( "AEI4:AEW19" ).Value
Case "MARAMAG 2",
Range( "E4:S19" ).Value = Range( "AEX4:AFL19" ).Value
Case "MARBEL 1",
Range( "E4:S19" ).Value = Range( "AFM4:AGA19" ).Value
Case "MARBEL 2",
Range( "E4:S19" ).Value = Range( "AGB4:AGP19" ).Value
Case "MARIKIT",
Range( "E4:S19" ).Value = Range( "AGQ4:AHE19" ).Value
Case "MATALAM",
Range( "E4:S19" ).Value = Range( "AHF4:AHT19" ).Value
Case "MATANAO",
Range( "E4:S19" ).Value = Range( "AHU4:AII19" ).Value
Case "MIDSAYAP",
Range( "E4:S19" ).Value = Range( "AIJ4:AIX19" ).Value
Case "MLANG",
Range( "E4:S19" ).Value = Range( "AIY4:AJM19" ).Value
Case "MONKAYO",
Range( "E4:S19" ).Value = Range( "AJN4:AKB19" ).Value
Case "NABUNTURAN 1",
Range( "E4:S19" ).Value = Range( "AKC4:AKQ19" ).Value
Case "NABUNTURAN 2",
Range( "E4:S19" ).Value = Range( "AKR4:ALF19" ).Value
Case "NABUNTURAN 3",
Range( "E4:S19" ).Value = Range( "ALG4:ALU19" ).Value
Case "OZAMIZ",
Range( "E4:S19" ).Value = Range( "ALV4:AMJ19" ).Value
Case "PADADA",
Range( "E4:S19" ).Value = Range( "AMK4:AMY19" ).Value
Case "PANABO 2",
Range( "E4:S19" ).Value = Range( "AMZ4:ANNP19" ).Value
Case "PANABO 3",
Range( "E4:S19" ).Value = Range( "ANO4:AOC19" ).Value
Case "PANABO 5",
Range( "E4:S19" ).Value = Range( "AOD4:AOR19" ).Value
Case "PANABO MAIN",
Range( "E4:S19" ).Value = Range( "AOS4:APG19" ).Value
Case "PANABO PDP 1",
Range( "E4:S19" ).Value = Range( "APH4:APV19" ).Value
Case "PANABO PDP 2",
Range( "E4:S19" ).Value = Range( "APW4:AQK19" ).Value
Case "PANTUKAN",
Range( "E4:S19" ).Value = Range( "AQL4:AQZ19" ).Value
Case "PEÑAPLATA",
Range( "E4:S19" ).Value = Range( "ARA4:ARO19" ).Value
Case "PIGKAWAYAN",
Range( "E4:S19" ).Value = Range( "ARP4:ASD19" ).Value
Case "POLOMOLOK 1",
Range( "E4:S19" ).Value = Range( "ASE4:ASS19" ).Value
Case "POLOMOLOK 2",
Range( "E4:S19" ).Value = Range( "AST4:ATH19" ).Value
Case "PUERTO",
Range( "E4:S19" ).Value = Range( "ATI4:ATW19" ).Value
Case "QUEZON",
Range( "E4:S19" ).Value = Range( "ATX4:AUL19" ).Value
Case "SAN FRANCISCO 1",
Range( "E4:S19" ).Value = Range( "AUM4:AVA19" ).Value
Case "STA. MARIA",
Range( "E4:S19" ).Value = Range( "AVB4:AVP19" ).Value
Case "STO NIÑO",
Range( "E4:S19" ).Value = Range( "AVQ4:AWE19" ).Value
Case "STO. TOMAS",
Range( "E4:S19" ).Value = Range( "AWF4:AWT19" ).Value
Case "SULOP",
Range( "E4:S19" ).Value = Range( "AWU4:AXI19" ).Value
Case "SURIGAO 2",
Range( "E4:S19" ).Value = Range( "AXJ4:AXX19" ).Value
Case "TACORONG 1",
Range( "E4:S19" ).Value = Range( "AXY4:AYM19" ).Value
Case "TACORONG 2",
Range( "E4:S19" ).Value = Range( "AYN4:AZB19" ).Value
Case "TAGBINA",
Range( "E4:S19" ).Value = Range( "AZC4:AZQ19" ).Value
Case "TAGUM 4",
Range( "E4:S19" ).Value = Range( "AZR4:BAF19" ).Value
Case "TIBUNGCO 1",
Range( "E4:S19" ).Value = Range( "BAG4:BAU19" ).Value
Case "TIBUNGCO 2",
Range( "E4:S19" ).Value = Range( "BAV4:BBJ19" ).Value
Case "TORIL 1",
Range( "E4:S19" ).Value = Range( "BBK4:BBY19" ).Value
Case "TORIL 2",
Range( "E4:S19" ).Value = Range( "BBZ4:BCN19" ).Value
Case "TRENTO",
Range( "E4:S19" ).Value = Range( "BCO4:BDC19" ).Value
Case "TULUNAN",
Range( "E4:S19" ).Value = Range( "BDD4:BDR19" ).Value
Case "TUPI",
Range( "E4:S19" ).Value = Range( "BDS4:BEG19" ).Value
Case Else
Range( "E4" ).Value = "Error encountered"
End If
End Sub
最后,从Close and Return to Microsoft Excel
菜单中选择File
。
如果您有任何问题或意见,请随时发表评论。