Solved

Displaying only certain numbers from a cell

Posted on 2012-03-23
8
161 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 3

Expert Comment

by:DaFranker
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 11

Expert Comment

by:Runrigger
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
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…

762 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

8 Experts available now in Live!

Get 1:1 Help Now