Instant Survey Quote

Instant Survey Quote Calculator

INSTANT SURVEY QUOTE CALCULATOR

Select Bedrooms 1 2 3 4 5 6
Select Property Type Studio Flat Terraced Semi-Detached Detached
Select Property Value

HomeBuyer Survey

£0

Building Survey

£0
let excelRows = []; const bedrooms = document.getElementById("bedrooms"); const propertyType = document.getElementById("propertyType"); const propertyValue = document.getElementById("propertyValue"); fetch("Sales List 1 June 2026(2).xlsx") .then(r => r.arrayBuffer()) .then(data => { const workbook = XLSX.read(data,{type:"array"}); const sheet = workbook.Sheets[ workbook.SheetNames[0] ]; excelRows = XLSX.utils.sheet_to_json( sheet, {header:1} ); }); bedrooms.addEventListener( "change", loadPropertyTypes ); function loadPropertyTypes(){ propertyType.innerHTML = ` Select Property Type `; propertyValue.innerHTML = ` Select Property Value `; const bedroom = bedrooms.value; const types = new Set(); excelRows.forEach(row => { const property = String(row[0] || ""); if( bedroom === "Studio" && property.includes("Studio") ){ types.add(property); } else if( bedroom !== "Studio" && property.startsWith( bedroom + " Bed" ) ){ types.add(property); } }); [...types].forEach(type => { const option = document.createElement( "option" ); option.value = type; option.textContent = type; propertyType.appendChild( option ); }); } propertyType.addEventListener( "change", loadValues ); function loadValues(){ propertyValue.innerHTML = ` Select Property Value `; const selected = propertyType.value; excelRows.forEach(row => { if(row[0] === selected){ const option = document.createElement( "option" ); option.value = row[1]; option.textContent = "£" + Number( row[1] ).toLocaleString(); propertyValue.appendChild( option ); } }); } propertyValue.addEventListener( "change", calculatePrice ); function calculatePrice(){ const selectedType = propertyType.value; const selectedValue = Number( propertyValue.value ); const row = excelRows.find(r => r[0] === selectedType && Number(r[1]) === selectedValue ); if(!row) return; /* Adjust these columns if required. HomeBuyer = column P = index 15 Building Survey = column G = index 6 */ let homeBuyer = row[15]; let buildingSurvey = row[6]; if( isNaN( Number(homeBuyer) ) ){ homeBuyer = "N/A"; } if( isNaN( Number(buildingSurvey) ) ){ buildingSurvey = "N/A"; } document.getElementById( "homebuyerPrice" ).innerHTML = homeBuyer === "N/A" ? "N/A" : "£" + Number( homeBuyer ).toLocaleString(); document.getElementById( "buildingSurveyPrice" ).innerHTML = buildingSurvey === "N/A" ? "N/A" : "£" + Number( buildingSurvey ).toLocaleString(); document.getElementById( "results" ).style.display = "grid"; }