diff --git a/Examples/ExcelBuiltIns/VLOOKUP.ps1 b/Examples/ExcelBuiltIns/VLOOKUP.ps1 new file mode 100644 index 0000000..a04fecb --- /dev/null +++ b/Examples/ExcelBuiltIns/VLOOKUP.ps1 @@ -0,0 +1,19 @@ +$xlfile = "$env:TEMP\test.xlsx" +Remove-Item $xlfile -ErrorAction SilentlyContinue + +$data = ConvertFrom-Csv @" +Fruit,Amount +Apples,50 +Oranges,20 +Bananas,60 +Lemons,40 +"@ + +$xl = Export-Excel -InputObject $data -Path $xlfile -PassThru -AutoSize + +Set-ExcelRange -Worksheet $xl.Sheet1 -Range D2 -BackgroundColor LightBlue -Value Apples + +$Rows = $xl.Sheet1.Dimension.Rows +Set-ExcelRange -Worksheet $xl.Sheet1 -Range E2 -Formula "=VLookup(D2,A2:B$($Rows),2,FALSE)" + +Close-ExcelPackage $xl -Show \ No newline at end of file diff --git a/Examples/ExcelBuiltIns/VLookUp.png b/Examples/ExcelBuiltIns/VLookUp.png new file mode 100644 index 0000000..421775f Binary files /dev/null and b/Examples/ExcelBuiltIns/VLookUp.png differ