Using xindy as index generator, it is possible to write additional information to index file, such as the section number s37,p100 or similar.
The relevant command is imki@wrindexentrysplit, the format can be specified in its 3rd argument, see the lines there.
However, xindy does not recognize this format initially, so there has to be an additional xindy module, the usage of it is specified within the options=-M sectionindex_sectionpage.xdy option to \makeindex.
I used a forloop to generate some dummy sections with dummy index entries, just for convenience. The index shows the format s{sectionnumber},p{pagenumber} .
\documentclass[paper=a4,12pt]{scrartcl} \usepackage{blindtext}% \usepackage{fmtcount}% \usepackage{forloop}% \usepackage[xindy]{imakeidx}% \makeatletter % Global redefinition of indexentry to use section, then page% \renewcommand{\imki@wrindexentrysplit}[3]{% \expandafter\protected@write\csname#1@idxfile\endcsname{}% {\string\indexentry{#2}{s\arabic{section},p\thepage}}% }% \makeatother \makeindex[options=-M sectionindex_sectionpage.xdy] \begin{document} \newcounter{loopcounter} \forloop{loopcounter}{1}{\number\value{loopcounter} < 13}{% \section{Section \Numberstring{loopcounter}} \blindtext \vspace{\baselineskip} This is a dummy index entry to \textbf{\Numberstring{loopcounter}}\index{\Numberstring{loopcounter}} } \printindex \end{document}
The file sectionindex_sectionpage.xdy contains
( require "tex/inputenc/latin.xdy") ( require "texindy.xdy" ) ( require "page-ranges.xdy") ( require "book-order.xdy") ( define-location-class "sectionfirstthenpages" ("alpha" :sep "" "arabic-numbers" :sep "," "alpha" :sep "" "arabic-numbers" ))

\documentclass{...}and ending with\end{document}.