# Table - find index of the maximum element [duplicate]

Let's suppose that I have table t = {1.23, 3.4, 10, 34, 1.78, 0.98, 12.56}. To take the biggest element I can use Max[t] function. But I want to take not only the maximum element, but also the index of the element (so, which element in table it is). Is any function which helps to take the indes of element, when I know the value of this element?

• Position[t,Max[t]]
– ciao
Commented Jan 22, 2014 at 22:24
• Commented Jan 22, 2014 at 23:00
• I am closing this as a duplicate, for now. There are a number of similar questions on this site that can be found by searching for Position, Ordering, etc. Several deal specifically with maximum values. Also, your question is not fully specified; do you want only the position of one or all maximum values for example? Further, this question is arguably "easily found in the documentation" for Position. If you have a more specific question please edit accordingly. Commented Jan 22, 2014 at 23:32
• @Ziva my closing this question was not meant to chastise you for asking; rather it is to keep the site organized to the extend that I am able. I know that the documentation can be hard to navigate. Searching this site is hopefully a bit easier, and every duplicate question provides another avenue to find what one is looking for, e.g. this one now uses the terminology "index" and in addition to Sjoerd's answer it points to two more questions which are hopefully helpful. (continued) Commented Jan 23, 2014 at 2:57
• For the documentation itself you could conceivably have found Position by searching for "index" the second result of which is the page for StringPosition, and the first link under "See Also" on that page is to Position. Convoluted, I know, but that's fairly common, so if you want to learn to use the documentation I suggest getting used to it. Another search term that would have been more direct is "Find" the second result for which is Position. Commented Jan 23, 2014 at 3:02

Ordering[t, -1]


which is orders of magnitude faster than

Position[t,Max[t]]

• Since the op states after initial example " Is any function which helps to take the indes of element, when I know the value of this element?", a much more general statement, not sure ordering will address it. Of course, if one is only after the last instance of a maximum (because if there are multiple, ordering again becomes a bit useless), this is the fastest way.
– ciao
Commented Jan 22, 2014 at 23:21
• Make sure to actually get the max index out of the list that "Ordering" returns. Ordering[t,-1][[1]]
– sffc
Commented Oct 14, 2015 at 21:27
• Ah, yes, of course. Commented Oct 14, 2015 at 21:53