Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default find by first two characters

I have a list of rows that contain cells in a varying number of columns. The
columns contain values like: 1-4895, 22-1456, 37-4568 etc. I would like to
copy and separate these cells into columns based on the numbers to the left
of the dash starting at 1, 22, 37 and so on. If the column has a heading of
22 for instance, it would list only the records that contained 22 as the
first numbers of the value. The end result would be that I could filter all
of the rows that had a cell the contained a value starting with 1, or 22 or
37 etc.
I suppose i'm looking for a formula that will copy only values that meet a
specific criteria like an IF statement that selects only the characters
before the dash.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default find by first two characters

You could split by selecting the column, then using Data/ text to columns/
delimited, & putting in the hyphen as a delimiter, but if the data isn't
conveniently in a column then that isn't so easy..
Alternatively you can separate out the characters to the left of the hyphen
by the formula =LEFT(A1,FIND("-",A1)-1), & filter by that.
If you have data in column A and you want to copy into a column with a
particular value in the top row, you could use
=IF(--LEFT(A2,FIND("-",A2)-1)=B$1,A2,"") and copy down and across.
--
David Biddulph

"Picman" wrote in message
...
I have a list of rows that contain cells in a varying number of columns.
The
columns contain values like: 1-4895, 22-1456, 37-4568 etc. I would like to
copy and separate these cells into columns based on the numbers to the
left
of the dash starting at 1, 22, 37 and so on. If the column has a heading
of
22 for instance, it would list only the records that contained 22 as the
first numbers of the value. The end result would be that I could filter
all
of the rows that had a cell the contained a value starting with 1, or 22
or
37 etc.
I suppose i'm looking for a formula that will copy only values that meet a
specific criteria like an IF statement that selects only the characters
before the dash.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,089
Default find by first two characters

Let's say the numbers are in A2 to A4:

A2 = 1-4895
A3 = 22-1456
A4 = 37-4568

and the digits before the hyphen are in cells B1 to D1

B1 = 1
C1 = 22
D1 = 37

Then, in cell B2, put the formula:

=IF(LEFT($A2,LEN(B$1))=TEXT(B$1,"@"),$A2,"")


Now drag down and across the cells ... from B2 down to B4 and across to D4

Regards

Trevor


"Picman" wrote in message
...
I have a list of rows that contain cells in a varying number of columns.
The
columns contain values like: 1-4895, 22-1456, 37-4568 etc. I would like to
copy and separate these cells into columns based on the numbers to the
left
of the dash starting at 1, 22, 37 and so on. If the column has a heading
of
22 for instance, it would list only the records that contained 22 as the
first numbers of the value. The end result would be that I could filter
all
of the rows that had a cell the contained a value starting with 1, or 22
or
37 etc.
I suppose i'm looking for a formula that will copy only values that meet a
specific criteria like an IF statement that selects only the characters
before the dash.



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
How to find no.of characters in a cell? great whole sale club limited kolkatta Excel Discussion (Misc queries) 2 November 8th 06 03:41 PM
find special characters Joe Ventre Excel Discussion (Misc queries) 1 July 27th 06 08:07 PM
In Excel find characters when multiple characters exist w/i a cel teacher-deburg Excel Worksheet Functions 1 December 5th 05 10:22 PM
find text characters Micayla Bergen Excel Discussion (Misc queries) 1 May 6th 05 07:44 AM
Need to find the 1st two characters of the 1st two words Tom Excel Worksheet Functions 2 April 21st 05 02:10 AM


All times are GMT +1. The time now is 04:58 PM.

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"