Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to check a list for single letters between text

Hi everyone,

i need some help regarding a big list of entries and dont want to put the
data manually.

In my list i have some Filenames which contain different information, but
there are some significant letters which tells me, which file i have.

it's like: FirstNumber_A_Date.pdf
SecondNumber_B_Date.pdf
ThirdNumber_C_Date.pdf

There are only 5 different types of documents which are catagorized by those
letters, A, B and C

I want to create a =IF function which will write the name of Doc Type into a
seperate Column in the same sheet. Filenames are in A1 - A 400 and i want to
seperate the Type name (A = Attachment, B = Batch, C = Current) and fill the
full length of text into B1 - B400.

My problem is, i dont know how to check a single letter in this filenames, i
tried it with: =if (A1="*A*";"Attachment";"Batch") I just tried it that way
to check if this single letter thing works, but there is the next problem,
how do i should write this code, that he check if A and C aren't there, it
should give me the information for B. I need a general code therefore.

Hope it's easy to understand, hard to explain in a foreign language :)

thanks in advance and best regards, Hunt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to check a list for single letters between text

Don't test for a single character, test for two !!

In VBA:

Sub marine()
Dim s As String
Dim findit As String
findit = "_A"
s = Range("A1").Value
If InStr(s, findit) 0 Then
MsgBox "Its an attachment"
End If
End Sub


As a worksheet formula:

=IF(LEN(A1)<LEN(SUBSTITUTE(A1,"_A","")),"its an attachment","")

--
Gary''s Student - gsnu200909


"Hunt" wrote:

Hi everyone,

i need some help regarding a big list of entries and dont want to put the
data manually.

In my list i have some Filenames which contain different information, but
there are some significant letters which tells me, which file i have.

it's like: FirstNumber_A_Date.pdf
SecondNumber_B_Date.pdf
ThirdNumber_C_Date.pdf

There are only 5 different types of documents which are catagorized by those
letters, A, B and C

I want to create a =IF function which will write the name of Doc Type into a
seperate Column in the same sheet. Filenames are in A1 - A 400 and i want to
seperate the Type name (A = Attachment, B = Batch, C = Current) and fill the
full length of text into B1 - B400.

My problem is, i dont know how to check a single letter in this filenames, i
tried it with: =if (A1="*A*";"Attachment";"Batch") I just tried it that way
to check if this single letter thing works, but there is the next problem,
how do i should write this code, that he check if A and C aren't there, it
should give me the information for B. I need a general code therefore.

Hope it's easy to understand, hard to explain in a foreign language :)

thanks in advance and best regards, Hunt

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How to check a list for single letters between text

Here is a VBA two-liner that automatically selects the appropriate response
(without testing anything)...

Sub ABC()
On Error Resume Next
MsgBox Choose(Asc(Split(Range("A6").Value, "_")(1)) - 64, _
"Attachment", "Batch", "Current")
End Sub

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
Don't test for a single character, test for two !!

In VBA:

Sub marine()
Dim s As String
Dim findit As String
findit = "_A"
s = Range("A1").Value
If InStr(s, findit) 0 Then
MsgBox "Its an attachment"
End If
End Sub


As a worksheet formula:

=IF(LEN(A1)<LEN(SUBSTITUTE(A1,"_A","")),"its an attachment","")

--
Gary''s Student - gsnu200909


"Hunt" wrote:

Hi everyone,

i need some help regarding a big list of entries and dont want to put the
data manually.

In my list i have some Filenames which contain different information, but
there are some significant letters which tells me, which file i have.

it's like: FirstNumber_A_Date.pdf
SecondNumber_B_Date.pdf
ThirdNumber_C_Date.pdf

There are only 5 different types of documents which are catagorized by
those
letters, A, B and C

I want to create a =IF function which will write the name of Doc Type
into a
seperate Column in the same sheet. Filenames are in A1 - A 400 and i want
to
seperate the Type name (A = Attachment, B = Batch, C = Current) and fill
the
full length of text into B1 - B400.

My problem is, i dont know how to check a single letter in this
filenames, i
tried it with: =if (A1="*A*";"Attachment";"Batch") I just tried it that
way
to check if this single letter thing works, but there is the next
problem,
how do i should write this code, that he check if A and C aren't there,
it
should give me the information for B. I need a general code therefore.

Hope it's easy to understand, hard to explain in a foreign language :)

thanks in advance and best regards, Hunt


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default How to check a list for single letters between text

Hi,

Put this in B1 and drag down

=LOOKUP(MID(A1,FIND("_",A1)+1,1),{"A","B","C"},{"A ttachment","Batch","Current"})

Mike

"Hunt" wrote:

Hi everyone,

i need some help regarding a big list of entries and dont want to put the
data manually.

In my list i have some Filenames which contain different information, but
there are some significant letters which tells me, which file i have.

it's like: FirstNumber_A_Date.pdf
SecondNumber_B_Date.pdf
ThirdNumber_C_Date.pdf

There are only 5 different types of documents which are catagorized by those
letters, A, B and C

I want to create a =IF function which will write the name of Doc Type into a
seperate Column in the same sheet. Filenames are in A1 - A 400 and i want to
seperate the Type name (A = Attachment, B = Batch, C = Current) and fill the
full length of text into B1 - B400.

My problem is, i dont know how to check a single letter in this filenames, i
tried it with: =if (A1="*A*";"Attachment";"Batch") I just tried it that way
to check if this single letter thing works, but there is the next problem,
how do i should write this code, that he check if A and C aren't there, it
should give me the information for B. I need a general code therefore.

Hope it's easy to understand, hard to explain in a foreign language :)

thanks in advance and best regards, Hunt

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to check a list for single letters between text

=IF(NOT(ISERR(FIND("_A_",A1))),"Attachment",IF(NOT (ISERR(FIND("_C_",A1))),"Current","Batch"))


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=159173

Microsoft Office Help



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How to check a list for single letters between text

And here is one more method for you to consider...

=CHOOSE(CODE(MID(A1,FIND("_",A1)+1,1))-64,"Attachment","Batch","Current")

--
Rick (MVP - Excel)


"Hunt" wrote in message
...
Hi everyone,

i need some help regarding a big list of entries and dont want to put the
data manually.

In my list i have some Filenames which contain different information, but
there are some significant letters which tells me, which file i have.

it's like: FirstNumber_A_Date.pdf
SecondNumber_B_Date.pdf
ThirdNumber_C_Date.pdf

There are only 5 different types of documents which are catagorized by
those
letters, A, B and C

I want to create a =IF function which will write the name of Doc Type into
a
seperate Column in the same sheet. Filenames are in A1 - A 400 and i want
to
seperate the Type name (A = Attachment, B = Batch, C = Current) and fill
the
full length of text into B1 - B400.

My problem is, i dont know how to check a single letter in this filenames,
i
tried it with: =if (A1="*A*";"Attachment";"Batch") I just tried it that
way
to check if this single letter thing works, but there is the next problem,
how do i should write this code, that he check if A and C aren't there, it
should give me the information for B. I need a general code therefore.

Hope it's easy to understand, hard to explain in a foreign language :)

thanks in advance and best regards, Hunt


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a list of text from a single cell on several worksheets? deidre Excel Discussion (Misc queries) 4 May 22nd 06 09:49 PM
Copy List of text to a single cell? nastech Excel Discussion (Misc queries) 3 February 15th 06 02:19 AM
Copy List of text to a single cell? CLR Excel Discussion (Misc queries) 0 February 13th 06 08:39 PM
How can I add a single letter to text already in a list of cells? Gazivaldo New Users to Excel 3 November 16th 05 05:24 PM
concetenate a single cell with a list of text in a text box into . Brian Brooks Excel Programming 1 November 11th 04 03:27 AM


All times are GMT +1. The time now is 05:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"