Posts Tagged Excel
Text Split with Excel Formula – Part II
Hi friends,
Here goes the Text Split formula Part II, which will explain how to split First Name, Middle Name and Last Name.
Of course, you can use this many other ways too, so try to understand the logic behind this.
Formulas Used:
Just like previous part, we are also going to use Left, Right & find formulas.
All the three formulas are much simple to use and the real magic is binding them together to get desired results.
LOGIC:
In the first part, we had used find to determine the location of space between two words and then we split it with left & right.
Now in this part we are going to find out further how to find out second space in the given string.
Situation:
If you have a string ‘Firstname Middlename Lastname’, in A3 how you will separate this text with formulas so that you will have firstname, middlename and lastname in separate columns.
Firstname:
Very easy just like what we did in the last part find out the place of separator and use left function.
The formula for the given example is…=LEFT(A3,FIND(” “,A3,1))
Middlename:
This is most interesting part that everybody wants. Here you need to use all the three functions together. First you find out 2nd location of separator and using left formula you will get string ‘firstname middlename’. Then using right formula as in part one you can separate middlename. As this is quiet complicated I will explain this step by step and then together.
Step 1: Find 2nd location of separator formula is … =FIND(” “,A3,FIND(” “,A3,1)+1)
Note: remember to add ‘1′ to last separator location to find out next, otherwise it will keep giving you same results.
Step 2: Find string ‘firstname middlename’ formula is … =LEFT(A3,FIND(” “,A3,FIND(” “,A3,1)+1))
Step 3: Use ‘Right’ function to separate middlename from string in step 2, formula is…=RIGHT(LEFT(A3,FIND(” “,A3,FIND(” “,A3,1)+1)),FIND(” “,A3,1))
Lastname:
Comparatively this is easy, and similar to what we did in last part the only difference is instead of 1st location of separator we are going to use last location of separator.
The formula for the given example is… =RIGHT(A3,LEN(A3)-FIND(” “,A3,FIND(” “,A3,1)+1))
Conclusion:
This way you can split ‘n’ number words with any given separator. Try to find out way to use string functions differently it has enormous power.
Please add your feedback and comments below.
4 comments December 22, 2008
Text Split with Excel Formula – Part I
It always happens that you need to use text to column feature in excel. for some it’s rare but from some it’s everyday exercise. Think about the advantages that you will get if you can split text with formulas.
Let’s see how you can do that with example:
If you have a string ‘Firstname Lastname’, in A3 how you will separate this text with formulas so that you will have firstname and lastname in separate columns.
There are two formulas involved.
Left and right
How to Use left formula for fisrtname:
the main factor in this formula is finding out the string length of the firstname as it will vary. The solution is find out the place of separator (space in given example)
The formula for given example will be… =left(A3,find(” “,A3,1))
Now the difficult part of it that is the right formula use for lastname:
here as well the main factor is finding out the length of the string lastname as it will also vary everytime. so to find out the length we will first find out the place of separator (space in given example) and reduce it from the total length.
The formula for given example will be… =right(A3,len(A3)-find(” “,A3,1))
In next part we will see how can we use the formulas to split text “Firstname Middlename Lastname”.
4 comments July 13, 2008
Excel – Format table with Zebra Stripes
This type of formatting of table is easily possible with Excel 2007, but before that it was a pain.
Let’s see how we can use conditional formatting to our advantage in this area.
‘Zebra Stripes’ is basically coloring your table’s each alternate row, this will increase the readability of the table.
Let’s see how to achieve this in step by step mode.
1. Select the entire table.
2. Goto Format – Conditional formatting
3. Select ‘Formula Is’ ption in 1st Dropdown
4. Enter Formula =Mod(Row(),2)=0
5. Select the color you want to fill every alternate row and click ok
The table you selected will get filled with White and other color you selected,
If you want it to be filled with other color than white You can also use following additional conditioning.
6. Goto Format – Conditional formatting
7. Select ‘Formula Is’ ption in 1st Dropdown
8. Enter Formula =Mod(Row(),2)=1
9. Select the color you want to fill every alternate row instead of white and click ok
You can use this same way for columns as well with Formula Column() instead of Row() above.
Hope you find this useful and use it in your daily works.
Please comment me your feedbacks and suggestions you can also mail me your excel queries.
7 comments November 11, 2007
Excel Function – LARGE
This is one of the rarely used functions in excel as many use it’s alternative Max().
Let’s first understand the difference between them so that we will come to know what are the situations where we can use Large instead of Max.
Max function returns the maximum value from the given range, where as Large function 1st sorts the given range internally and returns the i’th from the top.
What i mean is you can use Large function whenever you need to find out 2nd or 3rd largest value from a range or you can even find out sum of top 10 values using this function.
Let’s see the syntax and how to use this function:
Syntax: =Large(Range,i’th Value)
Example: I have a range from A1 to A10 containing some numbers and we need to find out values for following situations:
1. Largest value (even possible with Max function)
=Large(A1:A10,1) or =Max(A1:A10)
2. 2nd Largest Value
=Large(A1:A10,2)
3. 3rd Largest Value
=Large(A1:A10,3)
4. Sum of top 3 Values
=Sum(Large(A1:A10,{1,2,3}))
There are many other ways by which you can use this function in combination with sum and count so try it.
Note: There is also ‘Small‘ function, which works similar to this but exactly apposite way returning you nth smallest value from source array.
I would like if you comment on this article with your valuable suggestions and feedback.
8 comments November 10, 2007
Date formula help
I have a column of dates (column G) in date format and I’d like another column to display
the fiscal or academic year for that date. I’d basically like a formula that will look at the date in column G and tell me if it is from 2001-02 or 2002-03, etc using July 1-June 30 as the fiscal or academic year. How do I do this?
Formula :
=IF(G3>DATEVALUE(“06/30/” & YEAR(G3)),”Academic Year ” & YEAR(G3) & ” – ” &
YEAR(G3)+1,”Academic Year ” & YEAR(G3)-1 & ” – ” & YEAR(G3))
Add comment November 9, 2007
Quick list in place
Many a times you have a situation where in you have to type in again the same thing you have typed some time before. What you do? go select that cell again and copy paste….
Here is a way out to quick select list, just use (Alt + down arrow) and the entire list will appear just like auto filter in place. Then you can select whatever option you want.
1 comment October 7, 2007
More short cuts
Quick sheet add (Shift + F11)
Quick chart add (Select source data and press F11)
Quick copy and edit value of the cell in cell below (Ctrl + Shift + ‘)
Quick copy and edit formula of the cell in cell below (Ctrl + ‘)
Edit or create a comment in the current cell (Shift + F2)
Add comment October 6, 2007
Shortcut Keys for Formulas
‘Ctrl + A’
Use this key immediately after typing the function name e.g. =Sum, It will open up the function argument window, which provides details about input parameters of that function.
‘Ctrl+shift+A’
Use this key after typing the function name and ‘(‘ e.g. =Sum(, It shows the syntax for the function in-place, this proves useful many times.
1 comment September 29, 2007
How to create super hidden secrete worksheets
Many of the times there are situations where you wanted to have one confidential worksheet where you can keep your secrete data and which you refer on other sheets, or may be only some hidden worksheet whereby only specific person knows about it. And you wonder how to do that in Excel.
Yes there is a way in Excel, no I am not talking about sheet ->hide, all knows about it. It hides sheets from appearing in the tabs but when user goes and select Unhide Sheets from format menu it shows the list of all hidden sheets so a big problem!!!!. There is one better way to achieve more than just hide. And that’s the visibility of the sheet. Now in Excel there are 3 modes associated with sheet’s visible property as follows:
1. xlSheetVisible (-1)
2. xlSheetHidden (0)
3. xlSheetVeryHidden(2)
You can see and change this using VBA Editor (Alt + F11), Select sheet in Project Explorer (Ctrl + R), and see last property in properties window (F4).
So when you select ‘Sheet Hide’ the visible property to ‘0’ i.e. ‘xlSheetHidden’, which also appears in the list of hidden sheets.
To make sheets that will not appear in hidden sheets list, we need to change this property to xlSheetVeryHidden(2), so once you through with your work on that sheet you can come in VBA Editor and create this way super hidden secrete worksheet.
But wait that’s not all you can even use references from this sheet on other hidden sheets, as the sheet is still present in workbook all calculations will properly work.
But yes you still have to protect your workbook for the purpose of security.
Add comment September 10, 2007