# Need help on an Excel formula!

**URL:** <https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344>\
**Category:** Factual Questions\
**Created:** [October 24, 2001, 5:12pm UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344 "2001-10-24T17:12:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucie](https://avatars.discourse-cdn.com/v4/letter/l/ed8c4c/32.png) [@lucie](https://boards.straightdope.com/u/lucie)\
**Post date:** [October 24, 2001, 5:12pm UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/1 "2001-10-24T17:12:35Z")

</div>

I’ve been hitting the books and help function for an hour - this should be easy, but I cannot get anything to work

In Excel for Windows 95:

I have a list of accounts similar to the following:  
050.00 - Wells Fargo Widget Account  
100.10 - Wells Fargo Embezzlement Account  
750.20 - Salaries for Useless Dweebs

etc., for about 800 lines. I need to somehow isolate and delete the first 9 characters in the string, so my list will look like this:  
Wells Fargo Widget Account  
Wells Fargeo Embezzlement Account  
Salaries for Useless Dweebs

I know this is probably absurdly simple, but I can’t get it to work. Can anyone help me?

---

<div class="post-metadata">

**Author:** ![epeepunk](https://avatars.discourse-cdn.com/v4/letter/e/f19dbf/32.png) [@epeepunk](https://boards.straightdope.com/u/epeepunk)\
**Post date:** [October 24, 2001, 5:26pm UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/2 "2001-10-24T17:26:01Z")

</div>

Wow, two Excel questions in row for me. 🙂

The function you want is Mid combined with Len.

Mid(text, start, num\_chars)  
Text is the field you are trimming  
Start would be 10 (the first character of the text you want)  
Num\_Chars would be Len(field) - 9

When I am having trouble finding a function, I bring up the function list (Select More Functions … from the drop down to the left of the field editing area) and look at the lists. There is a short description that goes with the function that helps, and sometimes the name is a giveaway.

Good luck

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [October 24, 2001, 5:26pm UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/3 "2001-10-24T17:26:28Z")

</div>

I don’t know if it can be done in the spreadsheet; however, it’s easy to do in VBA, the programming language that comes with Excel. Record a macro that selects a cell and edits it, then go into the editor (can’t remember the key off the top of my head). The function to return a suffix of a string (which is what you want to do) is right$. Look that up in the help.

---

<div class="post-metadata">

**Author:** ![sailor](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sailor](https://boards.straightdope.com/u/sailor)\
**Post date:** [October 24, 2001, 5:43pm UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/4 "2001-10-24T17:43:57Z")

</div>

No need to use LEN. =MID(RC[-1],9,99) will strip the first 8 chars and leave the rest untouched, just use a number longer than the longest string.

---

<div class="post-metadata">

**Author:** ![lucie](https://avatars.discourse-cdn.com/v4/letter/l/ed8c4c/32.png) [@lucie](https://boards.straightdope.com/u/lucie)\
**Post date:** [October 24, 2001, 5:48pm UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/5 "2001-10-24T17:48:28Z")

</div>

Thanks you guys. I’ll see if I can make either of those work for me.

I used to work in a place where there was an Excel guru handy so I got lazy about all this. Now I’m trying to recover my lost knowledge and add to it, but it’s slow going.

---

<div class="post-metadata">

**Author:** ![lucie](https://avatars.discourse-cdn.com/v4/letter/l/ed8c4c/32.png) [@lucie](https://boards.straightdope.com/u/lucie)\
**Post date:** [October 24, 2001, 5:57pm UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/6 "2001-10-24T17:57:30Z")

</div>

I got eepunk’s working before I saw yours, sailor. Now I have several solutions. Thanks to you all.

---

<div class="post-metadata">

**Author:** ![Earthling](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@Earthling](https://boards.straightdope.com/u/Earthling)\
**Post date:** [October 24, 2001, 6:01pm UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/7 "2001-10-24T18:01:08Z")

</div>

I don’t know which version of Excel you’re using, but (IIRC) all versions since Excel 97 have a menu command to split data into columns:

Highlight the column with the text you want to separate  
Data \> Text to Columns  
Click on “Delimited”, click Next  
Choose “Other” as your delimiter and type in the “-”  
Click Next, next,…until you’re done.

---

<div class="post-metadata">

**Author:** ![rowrrbazzle](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/rowrrbazzle/32/414_2.png) [@rowrrbazzle](https://boards.straightdope.com/u/rowrrbazzle)\
**Post date:** [October 25, 2001, 4:35am UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/8 "2001-10-25T04:35:26Z")

</div>

Earthling, I’ll see your text-\>columns/delimited and raise you text-\>columns/fixed length. The same function you use with a delimiter can be used with fixed length columns.

---

<div class="post-metadata">

**Author:** ![Earthling](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@Earthling](https://boards.straightdope.com/u/Earthling)\
**Post date:** [October 25, 2001, 11:54am UTC](https://boards.straightdope.com/t/need-help-on-an-excel-formula/89344/9 "2001-10-25T11:54:31Z")

</div>

Thank you for pointing that out. _Somehow_ I got it into my head when I posted that “fixed length” means all columns are of the same width & therefore doesn’t apply to the OP - but of course that’s not the case. And I knew that, too. What was I thinking. :o
