Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Displaying only certain numbers from a cell

Posted on 2012-03-23
8
Medium Priority
?
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 34

Accepted Solution

by:
Norie earned 2000 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:Frank White
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:Frank White
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:Frank White
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 34

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:Frank White
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

688 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