Solved

Displaying only certain numbers from a cell

Posted on 2012-03-23
8
183 Views
Last Modified: 2012-03-23
I would like to have a formula in row f that would display only 5 of the numbers from column c.  I made an example of the numbers I need dispalyed by this formula please see f2 for this example,  It always going to be the 5 numbers after the 8 in the account code.

Thanks
experts.xlsx
0
Comment
Question by:wcody
  • 4
  • 2
  • 2
8 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 37757838
This will extract the number but as text:

=MID(C3,16,5)

if you want it as an actual number:

=MID(C3,16,5)+0
0
 
LVL 3

Expert Comment

by:DaFranker
ID: 37757868
You can use:

=LEFT(TRIM(MID(C2,SEARCH(8,C2)+1,LEN(C2))),5)

See modified example sheet:

experts.xlsx
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 37757874
be aware that the above will work only if your first 15 characters are "1    1    8    "

If that is always true, then award the points as above, if not, then you need to give examples of additional acct_cde values.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 3

Expert Comment

by:DaFranker
ID: 37757959
Well, the formula I gave will always give the five characters (or digits) immediately after the first "8" in the cell value, ignoring spaces.

Different conditions will require changes in the formula.
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 37757969
Sorry DaFranker, you hadn't responded at the time - I was referring caution to @37757838 not yours.

Your solution gets my vote (provided of course that there will never be another 8 in the first few characters to spoil the search pattern!)
0
 
LVL 3

Expert Comment

by:DaFranker
ID: 37758072
Yeah. Happens to me quite a bit that I start to reply, go do something else (or test what I'm about to post to make sure I don't confuse everyone).

I was trying to clarify for other users, who might think you were referring to both formulas.

If you want something that can parse the code based on spaces and such, and get the first five numbers from the last "block" or "group" of numbers, the formula gets a bit more complex but it can still be done (even without any VBA, though in this case I'd use one just to simplify my work coming up with one if I were the only user).
0
 
LVL 33

Expert Comment

by:Norie
ID: 37758307
Runrigger

The formula I posted does not rely on the first 15 characters being '1    1    8    ".

It doesn't refer to that anywhere.

What if there's never an 8?

Then you won't just get an incorrect result, you'll get an error.
0
 
LVL 3

Expert Comment

by:DaFranker
ID: 37758536
I relied on the statement "It['s] always going to be the 5 numbers after the 8 in the account code." in order to write my formula.

Going by that information provided, I built a formula that always gives the 5 numbers (or characters, since it's unspecified whether it should filter out letters or other non-numeric characters) after the "8".

Again, if you need any other conditions or parameters, it can be done. It's just likely to make the formula a bit more complex (or just different).
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now