Amending data and locking cells based on drop down selection and checkbox

nene24713

New Member
Joined
Jul 7, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Good morning,

I've struggled to solve this with data validation and formulas and believe I need to use VBA to solve this problem? This is something I do not have any experience with and so am really hoping someone will be able to help me?

  1. When the checkbox in cell E4 is unchecked I would like cells F25:J25, F26, F28:J29, F31:J31 to be locked and the contents cleared. When the checkbox is checked, the cells should be unlocked.

  2. When 'none' is selected in E5:
    • F37 should be 0.00/cleared and locked
    • F41, F50, F51 should also be cleared and locked
  3. When 'self-consumption' is selected in E5:
    • F37 should be unlocked
    • F41, F50, F51 should remain clear/locked
  4. When 'overnight-charging' is selected in E5:
    1. F37 should be 0.00/cleared and locked
    2. F41, F50, F51 should be unlocked
Thanks for looking

locking and clearing cells.xlsx
ABCDEFGHIJK
1
2
3
4PRODUCTSSolar
5Battery None
6
7
8
9AREAPostcodeIrradiance Zone
10
11RG1Zone 1 - London
12
13
14BILLELECTRICITY NOTE: If solar only installation, use standard rate only.
15
16Annual Consumption (kWh)4000.00
17Standard Rate (pence per kWh)0.17000
18Off-Peak Rate (pence per kWh - if applicable)0.10000
19Number of Off-Peak Hours4
20Average Unit Rate0.15833
21Export Tariff0.055
22
23
24SOLARNumber of ArraysArray 1Array 2 Array 3Array 4Array 5
25Number of Modules510
26Module Power (Wp)370370370370370
27Total Installed Cap (kWp)1.853.70   
28Orientation (° from south)5070
29Inclination (° from horizontal)3035
30Irradiance (kk)914854   
31Shading Factor (e.g. 0.94)0.961
32Annual Output1623.263159.80   
33Total Annual Output4783.06
34
35
36USESolar Self-Consumption31.36%
37Battery Self-Consumption20.00%
38Export48.64%
39
40
41OVERNIGHT CHARGINGBattery Make and ModelGrowatt 6.5
42Battery Size0.92
43Depth of Depletion92.00%
44Round Trip Efficiency92.50%
45Cannibalism (kWh per year)12
46Available Charge Daily0.8
47Annual Benefit (kWh) 251.84
48Pre Install Consumption4000.00
49Current Customer Rate0.15833
50New Standard Rate (pence per kWh)0.15000
51New Off-Peak Rate (pence per kWh)0.05000
52Annual Benefit (£)£25.22
53
54
55
Input
Cell Formulas
RangeFormula
D11D11=IF($C$11="","",LOOKUP(C11,Formulas!G2:H172))
E11E11=IF($D$11="","",LOOKUP(D11,Formulas!J2:K26))
F20F20=IF(OR($F$18="",$F$19=""),"",(((F17*(24-F19))+(F18*F19))/24))
G26:J26G26=IF($F$26="","",F26)
F27F27=IF(OR($F$25="",$F$26=""),"",(F25*F26)/1000)
G27:J27G27=IF(OR(G25="",G26=""),"",(G25*G26)/1000)
F30F30=IF(OR(F28="",F29=""),"",INDEX(INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$93"),MATCH($F$29,INDIRECT("'"&$E$11&"'!"&"$B$2:$B$93"),0),MATCH($F$28,INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$2"),0)))
G30G30=IF(OR(G28="",G29=""),"",INDEX(INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$93"),MATCH($G$29,INDIRECT("'"&$E$11&"'!"&"$B$2:$B$93"),0),MATCH($G$28,INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$2"),0)))
H30H30=IF(OR(H28="",H29=""),"",INDEX(INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$93"),MATCH($H$29,INDIRECT("'"&$E$11&"'!"&"$B$2:$B$93"),0),MATCH($H$28,INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$2"),0)))
I30I30=IF(OR(I28="",I29=""),"",INDEX(INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$93"),MATCH($I$29,INDIRECT("'"&$E$11&"'!"&"$B$2:$B$93"),0),MATCH($I$28,INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$2"),0)))
J30J30=IF(OR(J28="",J29=""),"",INDEX(INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$93"),MATCH($J$29,INDIRECT("'"&$E$11&"'!"&"$B$2:$B$93"),0),MATCH($J$28,INDIRECT("'"&$E$11&"'!"&"$B$2:$AL$2"),0)))
F32:J32G32=IF(OR(G28="",G29="",G31=""),"",G27*G30*G31)
F33F33=IF(F32="","",SUM(F32:J32))
F36F36=IF(F33="","",(Input!F16*0.375)/Input!F33)
F38F38=IF(F36="","",100%-F36-F37)
F42F42=IF($F$41="","",VLOOKUP($F$41,Formulas!$O$3:EP$9,ROWS($1:3),FALSE))
F43F43=IF(F41="","",LOOKUP(F41,Formulas!O3:O3,Formulas!Q3:Q3))
F44F44=IF(F41="","",LOOKUP(F41,Formulas!O3:O3,Formulas!R3:R3))
F45F45=IF(F41="","",LOOKUP(F41,Formulas!O3:O3,Formulas!S3:S3))
F46F46=IF(F41="","",F42*F43*F44)
F47F47=IF(F41="","",F46*(365-28)-F45)
F48F48=IF(F16="","",F16)
F49F49=IF($F$20="",$F$17,$F$20)
F52F52=IF(OR(F48="",F49="",F50="",F51=""),"",F47*(F50-F51)-((F50-F49)*F48)/1000)
Cells with Data Validation
CellAllowCriteria
F17:F18Whole numberbetween 0.01 and 0.99
F21Whole numberbetween 0.01 and 0.99
F50:H51Whole numberbetween 0.01 and 0.99
F37Custom=IFS(E5="None",0,E5="Overnight Charging",0,E5="Self-Consumption","0")
C11List=Formulas!$G$2:$G$172
F41:H41List=Formulas!$O$3:$O$9
F28:J28List=Formulas!$M$2:$M$37
E5:F5List=Formulas!$A$7:$A$9
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,212,933
Messages
6,110,759
Members
448,295
Latest member
Uzair Tahir Khan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top