Last row in text data

As we know that the counting function is used to return the last relative position for a mixed data, let us now learn how to return the last row on text data in Excel. To do this Excel uses the match function the generic Formula to perform this operation is as given below.

Generic Formula

=MATCH(REPT(text,number_times),lookup_array)

How the formula works

  1. To get the last row Excel uses the match function combined with a REPT function. The match function locates the last text value in the range of values in the approximate match mode, for this mode, the third argument of the match defaults to one.
  2. The generic parameter lookup_value is the value to be looked upon and this is intentionally made a value bigger than what value appears in the range.
  3. When we work with texts, a text value always appears at the end of the alphabetically sorted order.
  4. Since here we match a text, there is a need to create or build a lookup value that would never appear in the actual text (original text), but will always be the last, and to do this we use the Excel REPT function that repeats the alphabet ”z” 255 times (this means 255 is the largest number of characters that the Excel match function allows). When the match function does not find this value it would take a step back to the last value in the range of text valued and this return its position

Note on usage

  1. The approach specified above is not reliable when there are mixed data values (text and numbers).
  2. We can use the above-specified formula with other Excel functions such as the index functions and offset functions to create a dynamic range.

Example

Let us consider a random text data for which the last relative position is estimated. The result using the MATCH function is as shown below in the figure.

Figure 1. The last relative position for text data using the MATCH function

Our customers love us!
“The expert was absolutely amazing and stuck with me the whole way through. They were polite, patient, seemed to want to genuinely help me and provided a solution that I would never have managed otherwise. I could not be more thankful for their support and solution. Thank you!” - - Chris T, in California

Leave a Comment

avatar