Solved

Displaying only certain numbers from a cell

Posted on 2012-03-23
8
192 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

820 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