Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

Is there a way to remove everything in a field after a certain character using e xcel or anything else.

It's from a feed that has this format: Product name #85423 Product Name2 #84216 Product Name3 #51354 etc.. I want to get rid of everything after # TIA, Javi Javi, Assuming there's only one # in the string and the string is in A1, try this: =LEFT(A1,FIND("#",A1)) If you don't want the # in resulting string, you can use this: =LEFT(A1,FIND("#",A1)-1) If there's always a space before the # and you want to get rid of that too, chan ge the -1 to a -2, or wrap the whole thing in a TRIM: =TRIM(LEFT(A1,FIND("#",A1)-1)) --scott *************************************** Edwards, John B Mouse, Mickey Hancock, John W to eliminate middle namess from the names, use =IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))>1,LEFT(A1,FIND(" ",A1,FIND(" ",A1)+1)-1), A1)

************************************* A B 1 New York, 2nd Street 2009 reet 2009 2 Boston, 57th Street 2005 57th Street 2005 3

C New York Boston 2nd St

So in column B we can put the following formula:

=TRIM(LEFT(A1,FIND(",",A1)-1)) Here I use 3 Excel functions: TRIM(), to remove the spaces on the beginning and on the end of the string that we get; LEFT() to get the string to the left of th e splitter , in this case is the , character and FIND() to find the position of the splitter character. I remove 1 from the position that FIND() returns so that I do n t get the , character. In column C we can put the following formula to the the text that is on the righ t of the , character: =TRIM(RIGHT(A1,LEN(A1)-FIND(",",A1))) Here, instead of the LEFT() function, I use the RIGHT() because I want to get th e text on the right of the splitter character. I use the LEN() function to get the number of character that the string on column A has so that I can subtract the position where the FIND() function finds the splitter character. This way I get th e number of characters for the function RIGHT() to return, counting from the end of the string in column A. Example: the string in cell A1 has a LEN(A1) of 25 c haracters. The splitter character is found on position 9 of the string. So my form ula will return on cell C1 (25-9)=16 characters counting from the right of strin g in cell A1, the result will be 2nd Street 2009 . ************************************** If you want your spreadsheet's sheet name, filename or path to appear on your wo rksheet you can either type it into a cell or you can be smart and use the follo wing formulas to dynamically show the info directly on your worksheet. The following examples assume that the formulas are used in... F:\Excel\[Formula Samples.xls]Sheet1 Full path, file and sheet name: Formula: =CELL("filename",A1) Result: F:\Excel\[ Formula Samples.xls]Sheet1 Filename only: Formula: =MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1 , FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1) Result: Formula Samples.xls Path only: Formula: =LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1) Result: F:\Excel\ Sheet name only: Formula: =RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))- F IND("]",CELL("filename",A1),1)) Result: Sheet1

******************** How can I figure out someone or something's age in Excel if I have their birth d ate? Depending on whether you want an actual age or just to round down to the las t whole year, choose one of the following: =(TODAY()-Cell ref to Birth date)/365.26 to show the exact number of years, including a decimal for a partial year - but don't use this for people's ages. =INT((NOW()-Cell ref to Birth date)/365.26) will modify the above formula to

round down to the whole year only. You can use this one to avoid having ages g o up before the actual birth date! If the birth date were in cell B2, the formul a would look like this: =INT((NOW()-B2)/365.26) There is also an undocumented function included with Excel that will allow y ou to find differences between dates, surprisingly called DATEDIF. Using this fu nction, you could enter the following formula: =DATEDIF(Cell ref to Birth date, NOW(), "y") or, using our example reference , =DATEDIF(B2, NOW(), "y"). You could also use the TODAY function, making the formula =DATEDIF(B2, TODAY (), "y")

*************************************** Step 3: Type the following command DIR > [filename.xls] Example: C:\Users\ DIR > list.xls saves all the names of the files in users folder into a n Excel spreadsheet named list in the Users (parent) folder. You can change the .x ls extension to .txt or .doc and the command will save the file into a Notepad a nd Word documents respectively. There are a number of attributes that you can add to the DIR command to suite your preferences. For instance, if you need just the only the filenames you can use: DIR/B > [filename.xls] You can sort the filenames alphabetically: DIR/B/O:N > [filename.xls] And include all the names of the files in subfolders: DIR/B/O:N/S > [filename.xls] Remove the directory path: DIR/B/A-D/ O:N/S > [filename.xls] Finally save the Excel file to different folder: DIR/B/A-D/ O:N/S > [folderpath\filename.xls] Here is a list of attributes you can use: /A attribs Displays all files with specified attributes. D Directories R Read-only files H Hidden files

S System files A Files ready to archive - Prefix meaning not Several attributes may be combined e.g. /A:HD-R /O Lists files in sorted order. S By size (smallest first)

N By name (alphabetic)

E By extension (alphabetic) D By date & time (earliest first) G Group directories first - Prefix to reverse order

Several attributes may be combined e.g. /O:GEN-D /S /B /L Displays files in specified directory and all subdirectories. Uses bare format (no heading information or summary). Uses lowercase.

You might also like