Category: Microsoft Excel

  • Microsoft Excelஇல் COUNTIF, COUNTIFS பயன்படுத்துவது எப்படி?

    COUNTIF Function:

    The COUNTIF function counts the number of cells in a range that meet a single condition.

    Syntax:

    =COUNTIF(range, criteria)
    • range: The range of cells to count.
    • criteria: The condition to meet.

    Example:

    If you want to count how many students scored more than 50 in a list:

    =COUNTIF(B2:B10, ">50")

    This will count the number of cells in the range B2where the value is greater than 50.


    COUNTIFS Function:

    The COUNTIFS function counts the number of cells that meet multiple conditions.

    Syntax:

    =COUNTIFS(range1, criteria1, range2, criteria2, ...)
    • range1: The first range to evaluate.
    • criteria1: The first condition.
    • range2: The second range to evaluate.
    • criteria2: The second condition.

    Example:

    If you want to count how many students scored more than 50 and also have a status of “Pass”:

    =COUNTIFS(B2:B10, ">50", C2:C10, "Pass")

    This will count the number of cells in B2with values greater than 50 and in C2with the status “Pass”.


    Key Points:

    • COUNTIF is used for a single condition.
    • COUNTIFS is used for multiple conditions.
    • When specifying conditions, use appropriate comparison operators like >, <, =.

    These functions are useful for filtering and counting data based on conditions in Excel.

  • To Delete Blank Rows in excel using VBA

    Here’s a step-by-step guide to delete blank rows using VBA:

    Step 1: Open Excel and Enable the Developer Tab

    1. Open Excel and load your workbook.
    2. Enable the Developer tab if it’s not visible:
      • Go to File > Options.
      • In the Excel Options dialog box, click Customize Ribbon.
      • On the right side, check Developer and press OK.

    Step 2: Open the VBA Editor

    1. Click on the Developer tab.
    2. Click Visual Basic or press Alt + F11 to open the VBA editor.

    Step 3: Insert a New Module

    1. In the VBA editor, click on Insert in the top menu.
    2. Select Module to add a new module.

    Step 4: Write the VBA Code to Delete Blank Rows

    Copy and paste the following VBA code into the module:

    Sub DeleteBlankRows()
    Dim i As Long
    Dim lastRow As Long

    ' Find the last row with data in column A
    lastRow = Cells(Rows.Count, 1).End(xlUp).Row

    ' Loop from the last row to the first row
    For i = lastRow To 1 Step -1
    ' Check if the entire row is blank
    If WorksheetFunction.CountA(Rows(i)) = 0 Then
    Rows(i).Delete
    End If
    Next i
    End Sub

    Code Explanation:

    • lastRow = Cells(Rows.Count, 1).End(xlUp).Row: This line finds the last row with data in column A.
    • For i = lastRow To 1 Step -1: Loops through each row from the last row to the first row.
    • If WorksheetFunction.CountA(Rows(i)) = 0: Checks if the entire row is empty (no values).
    • Rows(i).Delete: Deletes the row if it is blank.

    Step 5: Run the Macro

    1. After pasting the code, close the VBA editor or minimize it.
    2. Go back to the Excel workbook.
    3. Press Alt + F8 to open the Macro dialog.
    4. Select DeleteBlankRows from the list and click Run.

    Step 6: Verify the Results

    • The macro will go through each row in your sheet, starting from the last row, and delete any rows that are completely blank.

    Notes:

    • The code deletes rows that are entirely blank. If a row has data in even one cell, it won’t be deleted.
    • If you want to target a specific column for blank rows instead of the entire row, you can modify the If condition to check only that column, like this
    If Cells(i, 1).Value = "" Then
        Rows(i).Delete
    End If
    • This will delete rows where column A is empty.
  • To combine data from multiple sheets into one sheet using a VBA macro

    Step 1: Open the VBA Editor

    1. Open your Excel workbook.
    2. Go to the Developer tab and click on Visual Basic (or press Alt + F11).

    Step 2: Insert a New Module

    1. In the VBA editor, click Insert in the top menu.
    2. Select Module to create a new module.

    Step 3: Write the VBA Code to Combine Sheets

    Here’s a simple VBA code that combines all sheets in your workbook into one:

    Sub CombineSheetsWithDifferentColumns()
    Dim ws As Worksheet
    Dim masterSheet As Worksheet
    Dim lastRowMaster As Long
    Dim lastRowSource As Long
    Dim lastColSource As Long
    Dim pasteRow As Long

    ' Create or Clear a MasterSheet for combined data
    On Error Resume Next
    Set masterSheet = Sheets("MasterSheet")
    On Error GoTo 0

    If masterSheet Is Nothing Then
    Set masterSheet = Worksheets.Add
    masterSheet.Name = "MasterSheet"
    Else
    masterSheet.Cells.Clear
    End If

    pasteRow = 1 ' Row to start pasting in the MasterSheet

    ' Loop through each worksheet in the workbook
    For Each ws In ThisWorkbook.Worksheets
    ' Skip the MasterSheet itself
    If ws.Name <> "MasterSheet" Then
    ' Find the last row and column with data in the source sheet
    lastRowSource = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
    lastColSource = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column

    ' If there is data, copy it
    If lastRowSource > 1 Then
    ' Copy data from the current sheet to the MasterSheet
    ws.Range(ws.Cells(1, 1), ws.Cells(lastRowSource, lastColSource)).Copy
    masterSheet.Cells(pasteRow, 1).PasteSpecial xlPasteAll

    ' Move to the next row in MasterSheet
    pasteRow = masterSheet.Cells(masterSheet.Rows.Count, 1).End(xlUp).Row + 1
    End If
    End If
    Next ws

    ' Optional: Autofit columns to adjust widths
    masterSheet.Columns.AutoFit

    MsgBox "All sheets have been combined into 'MasterSheet'."
    End Sub

    Step 4: Run the Macro

    1. Close the VBA editor and return to Excel.
    2. Press Alt + F8 to open the Macro dialog box.
    3. Select CombineSheets and click Run.

    Step 5: Review the Combined Data

    • The macro will create a new sheet named “MasterSheet” where all the data from the other sheets is combined.
    • If the “MasterSheet” already exists, it will be cleared and refilled with the new data.

  • To Combine Multiple Workbooks in Excel

    You can use VBA to combine workbooks and add the workbook name in first column and sheet name as the second column. Here’s a basic script:

    1. Open Excel and press Alt + F11 to open the VBA editor.
    2. Insert a new module by right-clicking on any existing module and selecting Insert > Module.
    3. Paste the following VBA code:
    Sub CombineWorkbooksWithNames()
        Dim FolderPath As String
        Dim FileName As String
        Dim WS As Worksheet
        Dim TargetSheet As Worksheet
        Dim LastRow As Long
        Dim SourceWB As Workbook
        Dim i As Long
    
        ' Set the path to the folder containing the workbooks
        FolderPath = "C:\Your\Folder\Path\"
    
        ' Create a new sheet for combined data
        Set TargetSheet = ThisWorkbook.Sheets.Add
        TargetSheet.Name = "CombinedData"
        TargetSheet.Cells(1, 1).Value = "WorkbookName"
        TargetSheet.Cells(1, 2).Value = "SheetName"
    
        ' Start looping through all Excel files in the folder
        FileName = Dir(FolderPath & "*.xls*")
        Do While FileName <> ""
            Set SourceWB = Workbooks.Open(FolderPath & FileName)
            
            ' Loop through all sheets in the workbook
            For Each WS In SourceWB.Sheets
                LastRow = TargetSheet.Cells(Rows.Count, 1).End(xlUp).Row + 1
                
                ' Copy data from the source sheet to the target sheet
                WS.UsedRange.Copy Destination:=TargetSheet.Cells(LastRow, 3)
                
                ' Add workbook name in the first column
                TargetSheet.Cells(LastRow, 1).Resize(WS.UsedRange.Rows.Count, 1).Value = SourceWB.Name
                
                ' Add sheet name in the second column
                TargetSheet.Cells(LastRow, 2).Resize(WS.UsedRange.Rows.Count, 1).Value = WS.Name
            Next WS
            
            SourceWB.Close False
            FileName = Dir
        Loop
    End Sub
    

    4. Modify the FolderPath to match the location where your workbooks are stored.

    5. Run the macro by pressing F5.

  • Office Automation Course in Tamil

    பொதுவாக அனைத்து அரசு மற்றும் தனியார் அலுவலகங்களில் பணியாற்றும் போது அதிகளவில் பயன்பாட்டில் இருப்பது Microsoft – Word , Excel , Powerpoint என்ற மென்பொருள்கள் (Software) ஆகும். இந்த மென்பொருள்களை எவ்வாறு பயன்படுத்துவது பற்றியும், பொதுவாக அலுவலகத்தில் பயன்படுத்தப்படும் அனைத்து வழிகளையும் மிகவும் குறைந்த கட்டணத்தில் நமது கணிணி பயிற்சி மையத்தில் மிகவும் தெளிவாக நாங்கள் கற்றுத்தருகிறோம்.

    மேலும் இது தொடர்பான வாழ்நாள் முழுதும் மறக்காமல் இருக்கவும் அவ்வப்போது வீடியோக்களையும் நாங்கள் உங்களுக்கு Youtube மூலம் அனுப்புவோம்.

    இது கற்றுக்கொள்ள தேவையான குறைந்தபட்ச தகுதி ஆங்கிலம் எழுத மற்றும் படிக்க தெரிய வேண்டும். வீட்டில் இருக்கும் படித்த பெண்கள், இளைஞர்கள், வேலைக்காக காத்திருப்போர்கள் என அனைவருக்கும் மிகவும் எளிமையாக கற்றுத்தருகிறோம்.

    Outline of Course

    1. Computer Fundamentals
    2. Operating Systems
    3. How use Paint and Notepad
    4. How working with Folders and Files
    5. Discussion about Memory Size
    6. Discussion about File Types
    7. Working with File Explorer , Thumbnails, Hidden File
    8. Ms Word – Before you Start
    9. Ms Word – Formatting
    10. Ms Word – Paragraphs
    11. Ms Word -Working with Ruler
    12. Ms Word – Line and Paragraph Spacing
    13. Ms Word – Bullets and Numbering
    14. Ms Word – Working with Tables
    15. Ms Word – Working with Pictures and Shapes
    16. Ms Excel- About Worksheet
    17. Ms Excel- Before You Start
    18. Ms Excel – Cell Reference and Formulas
    19. Ms Word- Page Breaks
    20. Ms Excel- About Printing & Page Setup
    21. Ms Excel – Header and Footer
    22. Ms Excel – About Rows to Repeat / Column to Repeat
    23. Ms Excel – Cell Alignment and Wrap Text , Merge Cells
    24. Ms Excel – Rename , Move and Delete Worksheets
    25. Ms Excel – Formatting Cells
    26. Ms Excel – Working with Custom Option in Format Cells
    27. Common – How Change Date Format in Computer
    28. Ms Excel – How move Last cell of Rows and Columns
    29. Ms Excel – Format Cells – Date
    30. Ms Excel – Format Cells – Text
    31. Power point – About Slides
    32. Power point – Animation
    33. Common – How Create Mail ID in Gmail
    34. Common – How Create Mail ID in Microsoft
    35. Ms Excel – How create Charts
    36. Ms Excel – Filter
    37. Ms Excel – Sorting
    38. Ms Excel – Hide / Unhide Rows and Columns
    39. Ms Excel – SubTotal
    40. Ms Excel – Data Validation
    41. Ms Excel – Split and Freeze Option
    42. Ms Excel – Page Breaks
    43. Common – About AI and Discussion about Some Tools
    44. Ms Excel – Insert and Delete Rows, To Set Equal Width and Height,
    45. Ms Excel- Borders and Shading
    46. Ms word – Borders and Shading
    47. Ms Word- To Set Water Mark in Page
    48. Ms Word- Object Selection , Group and Group
    49. Common – How Convert PDF from Word , Excel, Powerpoint Contents
    50. Common – How Share PDF using Whatsapp, Mail
    51. Ms Word- About Mail Merge
    52. Working with Google Sheets, Docs, Etc,
    53. LAB – Letter Writing , Official Letters, Bio Data, Chart , Student information, Etc.,
    54. Q and A Session