You’re getting that error because Index(Split(...), 2) is being evaluated in cases where Split() returns only one row — so the only valid index is 1, not 2.
"<table style='width:100%; border: 1px solid #D6DDE0; border-collapse: collapse;'>
<tr style='background-color:#1D4674;'>
<th style='border: 1px solid #D6DDE0;color: white;font-size:11px;font-weight:bold; padding: 4px;'>Group</th>
<th style='border: 1px solid #D6DDE0;color: white;font-size:11px;font-weight:bold; padding: 4px;'>Status</th>
</tr>
<tr>
<td style='border: 1px solid #D6DDE0; padding: 4px;font-size:11px;'>Department</td>
<td style='border: 1px solid #D6DDE0; padding: 4px;font-size:11px;'>" &
With(
{ depurl: Coalesce(ThisItem.Department.Url, ThisItem.Department.Value, ThisItem.Department) },
With(
{ hostPart: First(Split( Substitute(Substitute(depurl, "https://", ""), "http://", ""), "/" )).Value },
If(IsBlank(hostPart), "N/A", hostPart)
)
) &
"</td>
</tr>
</table>"
also there is a similar post suggestions have provided if its resolves your issue kindly mark as verified