Solved

Displaying only certain numbers from a cell

Posted on 2012-03-23
8
209 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 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: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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

628 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