Joyanta Mitra

About author

Joyanta Mitra, a BSc graduate in Electrical and Electronic Engineering from Bangladesh University of Engineering and Technology, has dedicated over a year to the ExcelDemy project. Specializing in programming, he has authored and modified 60 articles, predominantly focusing on Power Query and VBA (Visual Basic for Applications). His expertise in VBA programming is evident through the substantial body of work he has contributed, showcasing a deep understanding of Excel automation, and enhancing the ExcelDemy project's resources with valuable programming insights.


Excel and VBA Content Developer at ExcelDemy, SOFTEKO.

Lives in

Dhaka, Bangladesh.

Education in Electrical and Electronic Engineering, Bangladesh University of Engineering and Technology.


Verilog, Micropython, Mikroe C, Java(Core+TCP/IP), Digital design, Matlab, Assembly Programming.


  • Java games: Snake, Sudoku, Reinforcement Learning using Gym and Anaconda.


  • Ion Energy Distribution in Plasma, Prediction of Uniform Energy Electron Location.

Latest Posts From Joyanta Mitra

Excel Power Pivot Measures (5 Examples)

Power Pivot measures are a powerful way to perform calculations and analysis on your data in Excel. They allow you to create custom calculations, such as sums, ...

Excel Picture Format: A Complete Guide

In this article, we are going to explore how we can use Excel picture format feature to correct, resize, color, create an artistic style, make picture ...

Excel String Functions [Basics + Practical Example of 17 Functions]

In this article, we will explain 17 Excel string functions with all sorts of examples of every single function. Download Practice Workbook Excel ...

Workflow in Excel: A Must-Have Guide

In this article, we have given a detailed guide for creating and automating workflow in Excel. Workflow is necessary for company to synchronise steps of a ...

Comments in Excel (Insert, Copy, Format, Hide, Delete & Print)

In this article, we are going to explore how we can insert, copy, hide, format, and delete a comment. Moreover, we will see how we can insert a picture into ...

Excel Distribution Chart

Excel Distribution Chart: Knowledge Hub How to Create a Distribution Chart in Excel How to Plot Normal Distribution in Excel Plot Normal ...

How to Add Comma in Excel (10 Easy ways)

This article will explore how to add comma in Excel between numbers and names and use various functions to add commas in the cell. One common formatting ...

Excel Probability

In this article, we have used PROB, fractional method, NORM.DIST and NORMDIST function to find out Excel probability. Unraveling uncertainty in Excel ...

Dictionary in Excel (Create & Use)

In this tutorial, you will learn how to create a data dictionary, custom dictionary, and VBA dictionary. In addition to these, we will discuss how to use the ...

How to Insert, Delete Delta in Excel

In this Excel tutorial, you will learn how to insert the delta symbol in Excel. This article describes 7 different methods of inserting the delta symbol, ...

How to Insert and Use Timestamp in Excel?

In this article, you will learn 5 suitable ways to insert a timestamp in Excel with 5 practical applications of timestamp in Excel. The ways are: Using ...

Hide Excel Formulas (with Protecting Sheet & Without It)

This article covers the application of Format Cells dialog box and Review tab to hide Excel formulas. Also, we show the use of VBA code to do the same thing. ...

How to Randomize in Excel? (5 Effective Ways)

In this article, we are going to randomize Excel data and show the real-world use of randomizing data using five suitable methods in Excel. These methods are ...

Excel Auto Formatting (Add, Customize, Use & Remove)

In this article, we are going to explore how to use auto formatting in Excel and how we can modify and remove the formatting in Excel. We have used Excel ...

Numbering in Excel (Number Rows, Columns, Filtered Data, Alphabetical Order etc.)

Numbering in Excel is essential for organizing, sorting, and referencing data, facilitating efficient data entry, and calculations, and enhancing clarity in ...

Browsing All Comments By: Joyanta Mitra
  1. Dear April
    Thanks for your concern. There were some minor formatting issues with the VBA codes. Sorry for the inconvenience. We have updated our article. If you follow now, you will get the perfect calculator.
    Thanks for your help
    Joyanta Mitra

  2. Dear Adam,
    Thank you for your concern. You can not change the color of Excel button but you can use Command Button to change the button color.
    You can follow the steps below to color your command button:
    1. use Developer tab > Insert > ActiveX Controls > Command Button.
    Adding Command button
    2. A command will appear and right click on it.
    3. Choose CommandButton Object > Edit.
    right click on the command button
    Name the button as Start.
    4. Now right click on the command button and choose View Code.
    view code
    5. Then write code below for starting.

    Private Sub CommandButton2_Click()
    countDown = Now + TimeValue("00:00:01")
    Range("B4") = Range("B4") + TimeValue("00:00:01")
    Application.OnTime countDown, "StartTimer"
    CommandButton2.BackColor = 13959039
    End Sub

    Finally the button color has been added.
    start button colored
    6. Now create a stop buttom and use the code below:

    Private Sub CommandButton1_Click()
    Application.OnTime EarliestTime:=countDown, Procedure:="StartTimer", Schedule:=False
    CommandButton1.BackColor = 13959039
    End Sub

    7. Write down the code for reset button:

    Private Sub CommandButton3_Click()
    Range("B4") = TimeValue("00:00:0")
    CommandButton3.BackColor = 13959039
    End Sub

    Finally, you will have colored command button. You can change the color by changing color code 13959039.
    Final result

  3. Dear Kelley Sauer,
    Please use this formula below to count sales having date.
    =COUNTIF(E5:E14, "<>")
    Count cells when date is used
    It will count all sales with date. Using this formula, you will not get zero anymore. Moreover I have also used Ctrl+: to insert date.
    With Regards,
    Joyanta Mitra

  4. Dear Anas,
    You have to write the following code to get data validation for duplicate values, you have write the code below.

    Sub CreateUniqueDropDownListInC12()
        Dim ws As Worksheet
        Dim cell As Range
        Dim dict As Object
        Dim dataValidation As Validation
        Dim dvList As String
        ' Define the worksheet where you want to apply the data validation
        Set ws = ActiveSheet
        ' Create a dictionary object to store unique values
        Set dict = CreateObject("Scripting.Dictionary")
        Application.ScreenUpdating = False
        ' Loop through the specified range (C5 to C11)
        For Each cell In ws.Range("C5:C11")
            If cell.Value <> "" Then ' Check for non-empty cells
                If Not dict.Exists(cell.Value) Then
                    dict(cell.Value) = 1 ' Add the value to the dictionary
                End If
            End If
        Next cell
        ' Convert the unique values to a comma-separated string for data validation
        dvList = Join(dict.Keys, ",")
        ' Apply data validation with a dropdown list to cell C12
        Set dataValidation = ws.Range("C12").Validation
        With dataValidation
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=dvList
            .IgnoreBlank = True
            .InCellDropdown = True
            .ShowInput = True
            .ShowError = True
        End With
        Application.ScreenUpdating = True
    End Sub

    Then we get the data values of unique departments Marketing and Sales.
    datavalidation with duplicates
    With regards,
    Joyanta Mitra

  5. Dear Santosh Kumar,
    Please clarify the question. How can a person do more than 24 hours in 24 hours?
    With Regards.
    Joyanta Mitra

    End Position is given according to column To. Where there is RENT in To column, the number starts 1,2,3,4 and ends with SPACE1 numbered 5. Then next is Food starting 6,7,8, 9 and ends with SPACE2 numbered 10. Likewise, numbering is done for every cell data in End Position.
    Numbering End position
    Joyanta Mitra

  7. Code is alright. Please inform your particular problem.

  8. Dear Prince,
    Thank you very much for reading our article.
    According to your query, 1st you wanted to know about a formula to create a drop-down list that will be used to select different types of leaves. You will get that in Step 3 of this article. In our Excel file, we selected leave using the drop-down list in Record sheet. Also when you move to any month leave information will be based on the Record sheet. So, information will not move from one month to another. Try this and hope you will get the solution.
    Otherwise, send your Excel file with what you want to get and we will try to provide a solution. You can mail us at [email protected].
    Joyanta Mitra

  9. Dear Karlyn Martinez,
    For your convenience, I have showed the task with following steps.
    ● First, you have to recognize the pattern in the formula
    Showing pattern
    ● You can use Format Painter or drag the row to add a new row or rows for editing new data.

    Modifying data
    ● Now add new data.

    Adding new data
    ● Inset new rows in the Summary sheet.
    Inserting new rows in Summary sheet
    ● Insert the Entire row.
    Inserting new row
    ● Edit the code according to the main dataset. As now in Jan worksheet, new data is added, and so the range will be changed to AH$15 and $B$15.
    Showing the formula change

    Hope, this will be helpful for you.

    Joyanta Mitra
    Excel & VBA Content Developer

  10. This code will solve your problem. The code has a condition checking values blank or not.

    Sub Duplicates_Dif_Colors()
    Dim RG As Range
    Dim TT As String
    Dim CL As Range
    Dim CR As String
    Dim CP As Range
    Dim CD As Long
    Dim Cltn As Collection
    Dim J As Long
    On Error Resume Next
    If ActiveWindow.RangeSelection.Count > 1 Then
    TT = ActiveWindow.RangeSelection.AddressLocal
    TT = ActiveSheet.UsedRange.AddressLocal
    End If
    Set RG = Application.InputBox("Select range of data with duplicates:", "Duplicate values with Colors", TT, , , , , 8)
    If RG Is Nothing Then Exit Sub
    CD = 2
    Set Cltn = New Collection
    For Each CL In RG
    If CL.Value <> "" Then ' check if cell is not blank
    On Error Resume Next
    Cltn.Add CL, CL.Text
    If Err.Number = 457 Then
    CD = CD + 1
    Set CP = Cltn(CL.Text)
    If CP.Interior.ColorIndex = xlNone Then CP.Interior.ColorIndex = CD
    CL.Interior.ColorIndex = CP.Interior.ColorIndex
    ElseIf Err.Number = 9 Then
    MsgBox "Found excessive duplicates", vbCritical, "Duplicates with Colors"
    Exit Sub
    End If
    On Error GoTo 0
    End If
    End Sub


    Blank cells not colored

  11. Please write Ticker correctly both in your xlsx file and the code. Do not try to give invalid ticker or outdated ticker. Provide problems in detail for better service please.

  12. First, you have to create different power queries for each worksheet for other tickers and copy the same code. Otherwise, it triggers the first. Then for 10 different tickers,the code is

        TickerList = {"AAPL", "GOOG", "MSFT", "AMZN", "FB", "TSLA", "NVDA", "JPM", "BAC", "V"},
        StartDate = Excel.CurrentWorkbook(){[Name="StartDate"]}[Content]{0}[Column1],
        EndDate = Excel.CurrentWorkbook(){[Name="EndDate"]}[Content]{0}[Column1],
        #"Loop Through Tickers" = List.Transform(TickerList, each
                Ticker = _,
                Source = Csv.Document(Web.Contents(""&Ticker&"?period1"&StartDate&"&period2"&EndDate),[Delimiter=",", Columns=7, Encoding=1252, QuoteStyle=QuoteStyle.None]),
                #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
                #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"Open", type number}, {"High", type number}, {"Low", type number}, {"Close", type number}, {"Adj Close", type number}, {"Volume", Int64.Type}})
                #"Changed Type"
        #"Loop Through Tickers1" = #"Loop Through Tickers"{8}
        #"Loop Through Tickers1"

    this code creates 10 tables for 10 different tickers. You have to select one table according to Ticker and hover over the query in Workbook Query Section and press View in Worksheet. You will get the table have to create 10 sheets separately.

Advanced Excel Exercises with Solutions PDF