ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Count first and last characters (https://www.excelbanter.com/excel-worksheet-functions/262247-count-first-last-characters.html)

Elton Law[_2_]

Count first and last characters
 
Dear Expert,

I have got a file which have a system generated field below. (15 rows)
First character must be either "T", "F", "U".
Last character must be either "D", "S", "U".

How to write a function that can calculate how much "T" or "F" for the first
character under the series.
How to write a function that can calculate how much "D" or "S" for the last
character under the series.

TLD
TLD
FLD
TLD
TND
UU
TNS
TND
TNS
TMD
TMD
TLS
TMS
TLD
TMD


Jacob Skaria

Count first and last characters
 
Hi Elton

Try the below

=SUM(COUNTIF(A:A,{"T","F"}&"*"))
=SUM(COUNTIF(A:A,"*" & {"D","S"}))


--
Jacob (MVP - Excel)


"Elton Law" wrote:

Dear Expert,

I have got a file which have a system generated field below. (15 rows)
First character must be either "T", "F", "U".
Last character must be either "D", "S", "U".

How to write a function that can calculate how much "T" or "F" for the first
character under the series.
How to write a function that can calculate how much "D" or "S" for the last
character under the series.

TLD
TLD
FLD
TLD
TND
UU
TNS
TND
TNS
TMD
TMD
TLS
TMS
TLD
TMD


Elton Law[_2_]

Count first and last characters
 
Thanks .... nothing can challenge you ....

"Jacob Skaria" wrote:

Hi Elton

Try the below

=SUM(COUNTIF(A:A,{"T","F"}&"*"))
=SUM(COUNTIF(A:A,"*" & {"D","S"}))


--
Jacob (MVP - Excel)


"Elton Law" wrote:

Dear Expert,

I have got a file which have a system generated field below. (15 rows)
First character must be either "T", "F", "U".
Last character must be either "D", "S", "U".

How to write a function that can calculate how much "T" or "F" for the first
character under the series.
How to write a function that can calculate how much "D" or "S" for the last
character under the series.

TLD
TLD
FLD
TLD
TND
UU
TNS
TND
TNS
TMD
TMD
TLS
TMS
TLD
TMD


Ashish Mathur[_2_]

Count first and last characters
 
Hi,

you may try this

For counting T or F =SUMPRODUCT(1*(LEFT(D3:D17,1)={"T","F"}))
For counting S or D =SUMPRODUCT(1*(RIGHT(D3:D17,1)={"D","S"}))

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Elton Law" wrote in message
...
Dear Expert,

I have got a file which have a system generated field below. (15 rows)
First character must be either "T", "F", "U".
Last character must be either "D", "S", "U".

How to write a function that can calculate how much "T" or "F" for the
first
character under the series.
How to write a function that can calculate how much "D" or "S" for the
last
character under the series.

TLD
TLD
FLD
TLD
TND
UU
TNS
TND
TNS
TMD
TMD
TLS
TMS
TLD
TMD



All times are GMT +1. The time now is 06:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com