From 709ca612a1f5c3f30af0c94ea105f39a03c62356 Mon Sep 17 00:00:00 2001 From: swmal <897655+swmal@users.noreply.github.com> Date: Fri, 10 Jun 2022 11:21:03 +0200 Subject: [PATCH] #666 - INDIRECT function did not always set the correct data type when returning a single cell. --- .../Excel/Functions/RefAndLookup/Indirect.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/EPPlus/FormulaParsing/Excel/Functions/RefAndLookup/Indirect.cs b/src/EPPlus/FormulaParsing/Excel/Functions/RefAndLookup/Indirect.cs index 78b49f922..9a9655ae3 100644 --- a/src/EPPlus/FormulaParsing/Excel/Functions/RefAndLookup/Indirect.cs +++ b/src/EPPlus/FormulaParsing/Excel/Functions/RefAndLookup/Indirect.cs @@ -57,6 +57,13 @@ public override CompileResult Execute(IEnumerable arguments, P { return CompileResult.Empty; } + else if(!result.IsMulti) + { + var cell = result.FirstOrDefault(); + var val = cell != null ? cell.Value : null; + if (val == null) return CompileResult.Empty; + return new CompileResultFactory().Create(val); + } return new CompileResult(result, DataType.Enumerable); } }