web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Index function error
Power Apps
Suggested Answer

Index function error

(2) ShareShare
ReportReport
Posted on by 126
I receive an error while launching the app. The error is related to Index function.
 
The second argument to the 'Index' function must be between 1 and 2, the lower and upper bounds of the table.  The upper bound may be reduced due to the non-delegation limit
 
Here the department is a hyperlink column with values like http://abc.com. May i know what is the issue here?
 
Gallery Label Text Property
!IsBlankOrError(ThisItem.Department),
    Index(
        Split(
            ThisItem.Department,
            "http://"
        ),
        2
    ).Value,"N/A"
)
 
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    Firstly, you are missing the If() argument off the front - this works fine for me on a test list
    If(
       !IsBlankOrError(ThisItem.Department),
       Index(
          Split(
             ThisItem.Department,
             "http://"
          ),
          2
       ).Value,
       "N/A"
    )
    You could also do this
    If(
       !IsBlankOrError(ThisItem.Department),
       Right(
          ThisItem.Department,
          Len(ThisItem.Department) - 7
       ),
       "N/A"
    )
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Suggested answer
    MS.Ragavendar Profile Picture
    7,431 Super User 2026 Season 1 on at
    @Poweruser32490, You are getting that Index out-of-bounds error because the Split() is not always returning 2 rows.
     
    With(
        { url: ThisItem.Department },
        If(
            IsBlank(url),
            "N/A",
            If(
                StartsWith(url, "https://"),
                Mid(url, 9, Len(url) - 8),
                If(
                    StartsWith(url, "http://"),
                    Mid(url, 8, Len(url) - 7),
                    url
                )
            )
        )
    )
     
    In-addition to the @WarrenBelz there might be some cases the URL might come as https as well so extended the code compatible for both versions without split.
     
    ✅If this helped, please Accept as Solution to help others ❤️ A Like is appreciated 🏷️ Tag @MS.Ragavendar for follow-ups.
  • WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    @MS.Ragavendar is correct on the analysis here (if there is no second part of the split in any of the sample data, you are describing an invalid reference)- either use @MS.Ragavendar's solution or the second one I posted.
  • WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for. Happy to assist further if not.
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn   

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard