Author: Aniruddh

  • Removing Duplicates in Excel

    We sometime look for easy way to remove duplicate  entries from a large table without any filters or complicated formulas. Starting Office 2007, Microsoft added a direct method to remove duplicates from a range.  There is one shortfall in this method which I will describe later.

    • Use mouse or keyboard arrow keys with “Shift” button pressed to select the area which contains duplicate content.
    • Click on “Data” tab of excel and click “Remove duplicate” button in the multi function tool bar.
    • A dialog box pops up. In the dialog box define the columns of the area to be included in the comparison of individual rows. All cells of the two rows should thus not display the same content due to which the rows become duplicates of each other.
    • In the column field of dialog box, remove the check marks in front of the columns which needs to be ignored during the comparison and click ‘OK’.
    • The duplicates in the columns of excel has been removed.

    Note: If all the columns are not included in the comparison(when there are obvious differences between individual row),  Excel always first top most row out of the rows that have been identified as duplicate. This is needs attention when the previously excluded cells are required later.

    This method short fall is that, you will not be able to see which cells has duplicates. If you want to know which cells having the duplicate values, go to “Conditional formating” and select “Highlight Cell Rules”. In that, choose “Duplicate Values”.  In the pop up select color which you want to see for the duplicate values. Now, use a filter by color and select the color you have opted for duplicats. It will show all the cells with duplicate values. Once found, you can decide on which data need to be removed and which needs to be retained.

  • Rotating Tables in Excel

    After we create a  tables in Excel, we will realize that the columns could be better as rows and vice versa. So in this post we will have a look into excel tip which describes how to rotate tables or swapping columns and rows in Excel. This tip will work on Excel XP, Excel 2003, Excel 2007, Excel 2010. Swapping of columns and rows in excel using this method is very simple and it does not changes the data.

    How to Swap Row and Column in Excel Sheet

    Follow the steps given below, to perform swapping of rows and columns in a range.

    Swapping of rows and Columns in Excel

    • Select the area whose column and rows needs to be swapped.
    • Right click the selected area and select “Copy” if you want to create a new table keeping the original or Select “Cut” if you want to entirely replace the Table.
    • Select the cell where the table should be placed.Ensure that area where the we want to insert the Table should be the same as original.
    • Right click on your mouse or keyboard shortcut, select “Paste Special”.
    • A pop up dialogue box appears. Select the option “Transpose” which is places bottom right corner.
    • Select “OK”. Done. Your Table rows and columns swapped.

    If you are facing any issue for transposing the rows and columns then, please leave your issue in the comment section below.

  • Finding the Last Row in Excel using Excel VBA

    In excel there are situations where we need to find last row of an sheet. This can achieved by defining a variable and assigning the last row value to the variable and using offset property to find the last row.

    Method 1: Declaring the variable and assigning the last row to the variable.
    Eg:
    Dim FinRow   ‘Finrow is variable which hold the value of last row.
    Finrow=Range(“A65536”).End(x1Up).Row
    Now Finrow variable contains the last row number in Column “A”

    Now if you want to put total in the last row of Column “A” then use
    Range(“A”&Finrow+1).Value=”Total”

  • Conditional sum in MS excel using SUMIF

    In excel adding a range with one condition can be done with conditional formula called sumif. The conditional sum worksheet function  sumif adds the specified range based on the criteria. The sumif conditional sum accepts only one criteria. If you want to perform sum based on multiple criteria, then you need to use multi conditional sum formula sumifs.

    Syntax of conditional sum sumif Worksheet Function

    Syntax: =SUMIF(range, criteria, [sum_range]).

    Range: The range of cells that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored.
    Criteria: The criteria in the form of a number, expression, a cell reference, text, or a function that defines which cells will be added. For example, criteria can be expressed as 32, “>32”, B5, 32, “32”, “apples”, or TODAY().
    Important Note:  Any text criteria or any criteria that includes logical or mathematical symbols must be enclosed in double quotation marks (“). If the criteria is numeric, double quotation marks are not required.
    sum_range:The actual cells to add, if you want to add cells other than those specified in the range argument. If the sum_range argument is omitted, Excel adds the cells that are specified in the range argument (the same cells to which the criteria is applied).
    Note: If you dont define sumrange then excel adds the range based on criteria. sumrange is needed if you want add other than criteria range.

    Examples for sumif worksheet function

    Below are the example for conditional sum in excel.

    Conditional SUM

    So sumif excel formula to add only Apple is
    =SUMIF(A2:A6,”Apple”,B2:B6)
    If you are having multiple criteria for sum then you should use  multi conditional sum refer to my previous post on multiconditional sum.

    You can also use Wild card charectors with SUMIF function. In that way you can even extend the usage of SUMIF functions.

  • Multi condition sum in excel

    In our daily work in excel, there are situations,  which requires summing of range based on multiple conditions. In this scenario, multi conditional sum  formula of excel comes useful. Starting Excel 2007, we have a direct excel formula for multi conditional sum. The excel versions prior to 2007, we can use sumproduct excel function.
    SUMIFS is the multi conditional formula in Excel. For single criteria sum, we can use SUMIF function. Syntax of SUMIFS and SUMIF are slightly different. Learning these two functions, will help to work efficiently with Excel.

    Recommended Reading:

    How to use SUMIF function in Excel

    Multi Condition sum in Excel 2007, Excel 2010 and Later

    Syntax of multi condition formula Sumifs is
    =SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)
    Examples for multi condition sum:
    sum the numbers in the range A1:A20 only if the corresponding numbers in B1:B20 are greater than zero (0) and the corresponding numbers in C1:C20 are less than 10.
    Formula is: =SUMIFS(A1:A20, B1:B20, “>0”, C1:C20, “<10”)

    Multi Condition sum in Excel 2003 or older

    The alternate function for SUMIFS is sumproduct function in Excel. It does summing of ranges, based multiple sets of conditions. It is not as simple as SUMIFS. But once practiced and learned the logic, very useful.
    Syntax of multi condition formula sumproduct:
    =sumproduct((Criteria1)*(Criteria2)………..(CriterialN), Sumrange)
    Note: For using sumproduct as multi conditional sum, the ranges needs to be even.
    Let us take above example with sumproduct:
    =sumproduct((B1:B20>0)*(C1:C20<10)*(A1:A20))

    Multi condition sum using array function: Using array function for multi condition sum is not recommended as that takes more time and the formula is tedious and it requires every time to Shift+Ctrl+Enter. So i omitted array function here.

    This Excel tips and tricks I tried to cover the multi conditional sum in Excel. For your reference, below are the few other useful functions of excel.

    1. COUNTIF — COUNTIF excel function is useful for single criterion count.
    2. COUNTIFS- This excel function is useful for multi conditional count.

    There are many other count formulas in Excel. These are very commonly used functions of Excel.