Find position of last alphabetic letter in a cell

anglais428

Well-known Member
Joined
Nov 23, 2009
Messages
634
Office Version
  1. 2016
Platform
  1. Windows
I am looking for a formula that will identify the position of the last letter in a cell, ignoring punctuation and special characters.
E.g. If the text in a cell is:
This,text,in,a,cell,,,,,,
The result should be 19 as the last "L" is in position 19. It should ignore all the commas at the end.
 
if result is ok, you can use Power Query (Get&Transform)
Code:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Replace = Table.ReplaceValue(Source,"...","###",Replacer.ReplaceText,{"Raw"}),
    LastChar = Table.TransformColumns(Table.AddColumn(Replace, "Text", each Text.Select([Raw],{"a".."z","A".."Z"})), {{"Text", each Text.End(_, 1), type text}}),
    Position = Table.SelectColumns(Table.AddColumn(LastChar, "Position", each Text.PositionOf([Raw], [Text], Occurrence.Last)+1),{"Text", "Position"})
in
    Position
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top