User Posts: Tanjima Hossain
0
How to Do SUMIF Date Range Month in Excel (9 Ways)
0

If you are looking for some of the easiest ways to do SUMIF date range month, then you are in the right place. For calculating records of sales or expenditures ...

0
How to Split String by Length in Excel (8 Ways)
0

If you are looking for some of the easiest ways to split string by length in Excel, then you are in the right place. So, let’s get started with this article. ...

0
How to Convert Text to Date in Excel (10 ways)
0

If you are looking for some of the easiest ways to convert text to date in Excel, then you will find this article useful. So, let’s dive into the article. ...

0
How to Delete All Rows Below a Certain Row in Excel (6 Ways)
0

If you are looking for some of the easiest ways to delete all rows below a certain row in Excel, then you are in the right place. By following the methods in ...

0
How to Calculate Running Total in Excel (9 Ways)
0

If you are looking for some of the easiest ways to calculate the running total in Excel, then you will find this article useful. Running total means a ...

0
How to Sum Colored Cells in Excel Without VBA (7 Ways)
0

If you want to know some of the easiest ways to sum colored cells in Excel without VBA then you will find this article useful. While working with Excel ...

0
How to Do SUMIF by Month and Year in Excel (7 Ways)
0

If you are looking for some of the easiest ways to do SUMIF by month and year, then you are in the right place. For calculating records of sales or ...

0
How to VLOOKUP Minimum Value in Excel (Easiest 8 Ways)
0

If you are looking for some of the easiest ways to VLOOKUP minimum value in Excel, then you will find this article worth it. While working with Excel it ...

0
How to Highlight Lowest Value in Excel (11 Ways)
0

If you are looking for some of the easiest ways to highlight the lowest value in Excel, then you will find this article worth it. While working with Excel ...

1
How to Remove Specific Text from Cell in Excel (Easiest 11 Ways)
0

If you are looking for some of the easiest ways to remove specific text from a cell in Excel, then you will find this article worth it. While working with ...

0
How to Compare 4 Columns in Excel VLOOKUP (Easiest 7 Ways)
0

If you are looking for some of the easiest ways to compare 4 columns in Excel VLOOKUP, then you are in the right place. Sometimes it becomes necessary to ...

0
How to Count If Cell Contains Number (Easiest 7 Ways)
0

If you are looking for some of the easiest ways to count if a cell contains number in Excel then you will find this article worthy of it. Sometimes different ...

0
How to Delete Every nth Row in Excel (Easiest 6 Ways)
0

If you are looking for the easiest ways to delete every nth row in Excel, then you may find this article helpful. Sometimes it is needed to delete every 2nd, ...

1
How to Match Multiple Columns in Excel (Easiest 5 ways)
0

If you are looking for some of the easiest ways to match multiple columns in Excel then you might find this article beneficial. Sometimes it becomes necessary ...

0
How to Count Rows with Text in Excel (Easiest 8 Ways)
0

If you are looking for some of the easiest ways to count rows with text in Excel, then you will find this article worthy of it. Sometimes different texts and ...

Browsing All Comments By: Tanjima Hossain
  1. Hello NILSEN,
    Hope you are doing well. Here, I have inserted a comment to cell B3 and in this comment, we have some text along with an image. So, using a VBA code I will show the process of extracting the image and texts in different cells.

    1

    • Type the following code.

     Sub PullPicturesFromComments()
    Dim Comment As Comment
    Dim Range As Range
    Dim Visible As Boolean
    Dim str_com As String
    Dim ShapeHeight, ShapeWidth As Integer
    Application.ScreenUpdating = False
    For Each Comment In ActiveSheet.Comments
    With Comment
    str_com = .Text
    ShapeHeight = .Shape.Height
    ShapeWidth = .Shape.Width
    .Text Text:="" & Chr(10) & ""
    Visible = .Visible
    .Visible = True
    On Error Resume Next
    Set Range = .Parent.Offset(0, 4)
    .Shape.CopyPicture Appearance:=xlScreen, Format:=xlPicture
    Range.PasteSpecial
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.Width = Range.Width
    Selection.Height = Range.Height
    .Visible = Visible
    .Text Text:=str_com
    .Parent.Offset(0, 3) = str_com
    End With
    Next Comment
    Application.ScreenUpdating = True
    End Sub 

    2

    In the figure above, look at the highlighted portions which you may want to change. Set Range = .Parent.Offset(0, 4) will insert the image in a cell which is 4 columns right to the main cell B3 and .Parent.Offset(0, 3) will insert the texts in a cell which is 3 columns right to the main cell B3.

    • Press F5.
    Then, we transferred the texts and images from the comment into different cells.

    3

    Best Regards,
    Tanjima Hossain
    ExcelDemy

  2. Hello JORDAN,

    Hope you are doing well! As per your requirement, I am considering the following scenario where in a table I have two lists of products with which I will compare the products in the Order List column. I will use a formula that will match a product from the Order List column with products from the Product List 1 column, for matches, the name of the product will return. Otherwise, the formula will search for matches in the Product List 2 column and will return the product name if any matches are found. Otherwise, we will get “No Match”.

    1

    • Enter the following formula in cell F4.
    =IF (COUNTIF ($B$4: $B$10, E4)>0, E4, IF (COUNTIF ($C$4: $C$10, E4)>0, E4, "No Match"))
    • Drag down the Fill Handle tool.

    2

    Finally, we are having Green Apple and Kiwi as they appear in the Product List 2 column, and Banana as it appears in the Product List 1 column.

    3

    Best Regards,
    Tanjima Hossain
    ExcelDemy

  3. Hello ERFLING,

    Thanks for your valuable suggestion. But you can take a look at Section 7 of this article which may align with this requirement.

    Thanks
    Tanjima Hossain
    ExcelDemy

  4. Hello SEAN,
    Here, we have listed the following tasks in a sheet which we will classify according to their importance and urgency.

    1

    • For creating drop-down lists for each of the cells in range C5:D12, we have opened the Data Validation dialog box.
    • In the Source box, type High, Medium, Low.

    2

    Then, we selected the following values for the tasks in the Task sheet.

    3

    In another sheet named Matrix, we have created the following template.

    4

    • For the portion of High Important and High Urgent use the following formula in cell D5, press ENTER, and use the AutoFill feature up to cell D8.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="High")*(Task!$D$5:$D$12="High"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    5

    • For the portion of High Important and Medium Urgent use the following formula in cell F5, press ENTER, and use the AutoFill feature up to cell F8.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="High")*(Task!$D$5:$D$12="Medium"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    6

    • For the portion of High Important and Low Urgent use the following formula in cell H5, press ENTER, and use the AutoFill feature up to cell H8.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="High")*(Task!$D$5:$D$12="Low"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    7

    • For the portion of Medium Important and High Urgent use the following formula in cell D9, press ENTER, and use the AutoFill feature up to cell D12.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="Medium")*(Task!$D$5:$D$12="High"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    8

    • For the portion of Medium Important and Medium Urgent use the following formula in cell F9, press ENTER, and use the AutoFill feature up to cell F12.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="Medium")*(Task!$D$5:$D$12="Medium"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    9

    • For the portion of Medium Important and Low Urgent use the following formula in cell H9, press ENTER, and use the AutoFill feature up to cell H12.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="Medium")*(Task!$D$5:$D$12="Low"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    10

    • For the portion of Low Important and High Urgent use the following formula in cell D13, press ENTER, and use the AutoFill feature up to cell D16.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="Low")*(Task!$D$5:$D$12="High"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    11

    • For the portion of Low Important and Medium Urgent use the following formula in cell F13, press ENTER, and use the AutoFill feature up to cell F16.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="Low")*(Task!$D$5:$D$12="Medium"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    12

    • For the portion of Low Important and Low Urgent use the following formula in cell H13, press ENTER, and use the AutoFill feature up to cell H16.
    =IFERROR(INDEX(Task!$B$5:$B$12,SMALL(IF((LEN(Task!$B$5:$B$12)<>0)*(Task!$C$5:$C$12="Low")*(Task!$D$5:$D$12="Low"),ROW(Task!$B$5:$B$12)-ROW(Task!$B$4),""),ROW(Task!B5)-ROW(Task!$B$4))),"")

    13

    Note:
    Here, we have used the sheet name Task in all our formulas, if you have any other sheet name, then put this name in the formulas.

    Regards
    Tanjima Hossain

  5. Hello JAN T,
    Hope you are doing well. I think by following the below-stated procedures you can make your code work.
    • After going to your VBE window, go to the Tools tab >> References option.

    4

    Then, the References – VBAProject window will appear.
    • Check the following options.
    o Microsoft Scripting Runtime
    o Microsoft WinHTTP Services, version 5.1
    • Press OK.

    1

    • Now, type the following code.

     Public Function Calculate_Distance(start As String, dest As String, Alink As String) As Double
        Dim first_Value As String, second_Value As String, last_Value As String
        Dim mitHTTP As Object
        first_Value = "http://maps.googleapis.com/maps/api/distancematrix/json?origins="
        second_Value = "&destinations="
        last_Value = "&mode=car&language=pl&sensor=false&key=" & Alink
        Set mitHTTP = CreateObject("MSXML2.ServerXMLHTTP")
        Url = first_Value & Replace(start, " ", "+") & second_Value & Replace(dest, " ", "+") & last_Value
        mitHTTP.Open "GET", Url, False
        mitHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
        mitHTTP.Send ("")
        If InStr(mitHTTP.ResponseText, """distance"" : {") = 0 Then GoTo ErrorHandl
        Set mit_reg = CreateObject("VBScript.RegExp"): mit_reg.Pattern = """value"".*?([0-9]+)": mit_reg.Global = False
        Set mit_matches = mit_reg.Execute(mitHTTP.ResponseText)
        tmp_Value = Replace(mit_matches(0).Submit_matches(0), ".", Application.International(xlListSeparator))
        Calculate_Distance = CDbl(tmp_Value)
        Exit Function 
    ErrorHandl:
        Calculate_Distance = -1
    End Function  

    2

    Make sure to add a third argument in your code and use it in the indicated place.
    • Finally, go to your sheet and use the following function.
    One thing to mention is that make sure to use a valid API address, otherwise, you will get an error.

    3

    Regards
    Tanjima Hossain

  6. Hello MAREK,
    Hope you are doing well. As far as I understand, you wanted to change the position of the background images or hide any row with these images. I think we can do these works as I demonstrated below.
    Firstly, in Section 1, you can move the background image by clicking on the cell and then dragging it to your desired position.

    1

    • Here, we have dragged the image beside the cell and changed the text written also in this cell.

    2

    • In Section 3, you can move the image along with the text to any position by only clicking on this cell and then dragging it.

    3

    In this way, we have changed the position.

    4

    • Later, we also changed the text.

    5

    • If you want to hide any row, then just click on this row, and then Right-click.
    • Select the Hide option.

    6

    Eventually, we have hidden our desired row.

    7

  7. Hello PEDRO,
    As per your question, I will try to show an easier way to remove a specific value from a row. Here, we have the specific text “Furniture” in three rows which we will remove from these rows.

    1

    • Go to the Home tab >> Find & Select dropdown >> Replace option.

    2

    Then, you will have the Find and Replace dialog box.

    • Type Furniture in the Find what box, and blank in the Replace with box.
    • Click on Replace All.

    3

    Then, a message box will notify you about the number of replacements.

    4

    In this way, we have removed Furniture from three rows.

    5

    If you want to remove this specific text from a specific row only, then before doing the stated procedures just select that specific row.

    Best Regards,
    Tanjima Hossain

  8. Hello ANTHONY,
    If your second to the last row is situated in Row 11, then you can use the following formula.
    =INDEX(‘[Sales.xlsx]Dataset’!$A$11:$H$11,COUNTA(‘[Sales.xlsx]Dataset’!$A$11:$H$11))
    You have to just change the reference according to the position of your desired row.

    Best Regards
    Tanjima Hossain

  9. Hello STEFAN,

    But we can open our password-protected files using the stated procedures. I have tried this way right now, and it worked. I could also change the values of worksheets.
    You may check out the procedures again and try them out.
    Thank You
    Tanjima Hossain

  10. Hello DARREN,
    Hope you are doing well. So, to solve your issue you can follow the stated procedures below.
    Here, we have the following three sheets- April, May, June, etc. Using a VBA code, we will print all these sheets into PDF format separately.

    1

    2

    3

    • Type the following code in your Visual Basic Editor window.

     Sub SaveAsPDF()
    Dim filename As String
    Dim ws As Worksheet
    Dim mywsname As String
    For Each ws In Worksheets
    ws.Select
    mywsname = ws.Name
    filename = "D:\Exceldemy\" & mywsname
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=filename, _
    Quality:=xlQualityStandard, IncludeDocProperties _
    :=True, IgnorePrintAreas:=False, openafterpublish:=True
    Next ws
    End Sub 

    4

    Finally, you will get the PDF files in your designated folder.

    5

    Also, the PDF files will be opened automatically.

    6

    I hope these steps will give your desired results.

    Thank you
    Tanjima Hossain

  11. Hello MRA,

    Thanks for your appreciation. Stay with us always.

    Best Regards
    Tanjima Hossain

  12. Hi RICK,
    The maximum number of sheets in a workbook is 255. So, if you have values in rows on basis of which you will split your sheet for more than 255 rows, then you may face a problem.

  13. Hello KEVIN,
    Hope you are doing well. You can follow the procedures below to get the address of the rightmost cell.
    Here, we have taken the following dataset into our consideration. Suppose, the user selected the header of the dataset which is A3:G3.

    1

    • Go to the Developer tab >> Visual Basic option to open the Visual Basic Editor window.

    2

    • Use the following code.

    Sub right_most_cell()
    Dim S_RANGE As Range
    Set S_RANGE = Selection.Cells(Selection.Rows.Count, Selection.Columns.Count)
    MsgBox "The right-most cell of the selected range is " & S_RANGE.Address
    End Sub

    3

    • Press F5.
    Then, you will get the following message with the rightmost cell of the selected range $G$3.

    4

  14. Hello DOUG,
    Hope you are doing well. You can follow the stated technique below to keep the pivot tables intact in a worksheet.
    Here, in a range I have used a formula to add up the sales values, besides it, I have a pivot table that I don’t want to change.

    1

    • Type the following code.
    Sub Remove_Formulas_from_the_Whole_Worksheet()
    Sheet_Name = InputBox(“Enter the Name of the Worksheet to Remove Formulas: “)
    Dim R As Range
    Set R = Application.InputBox(Title:=”Number Format Rule From Cell”, _
    Prompt:=”Select the range”, Type:=8)
    Worksheets(Sheet_Name).Activate
    R.Copy
    R.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
    Application.CutCopyMode = False
    End Sub

    2

    After running the code, an input box will appear.
    • Type the name of the sheet on which you are working (here it is Sheet1) and press OK.

    3

    Then, another input box will open.
    • Select the range which you want to change and press OK.

    4

    After that, the formula from our selected range will be removed.

    5

    Thanking you
    Tanjima Hossain

  15. Hello KHOR,
    After pressing F5 I am having the input box with the help of which I could select the range of repeated numbers easily and perform the row repetition. But if this shortcut key is not working for you then you can try the following technique.
    • Press the Run button above your code.

    1

    Then, the input box will appear.
    • Go to the main sheet and select your range containing numbers up to which you want to repeat.

    2

    • After pressing OK, you will get the work done.

    3

    Hope this way will help you solve your problem.

    Thanking You
    Tanjima Hossain
    ExcelDemy

  16. Hi SANSHI,
    You can use the direct method to calculate the PPF interest easily.
    For calculating the PPF interest, we will be using the following dataset. Here, we have the total Balance, Deposits from April to March, and an Interest Rate of 5%.
    1
    • For the monthly interest rates use the following formula
    =IF(C4=”Before 5th”,($A$2+B4)*(D4/12),($A$2)*(D4/12))
    2
    • For the first month of getting the balances, apply the following formula in cell F4.
    =$A$2+B4
    3
    • To get the rest of the balances type the following formula
    =$A$2+SUM($B$4:B5)
    Drag down the Fill Handle tool.
    4
    The final output will look like the following figure.
    5

  17. Hi MRBRAT2U,
    Thanks for reaching us. You can use the following code to execute your desired operation.
    According to your requirement, I have created a source worksheet wsx containing a list of projects with their costs up to 9999 rows.
    1
    For the results, we have enlisted some project names in the Sheet2 column and after running the code we will extract the cost values in the Cost column.
    2
    • Type the following code in your created module.

    Sub vlookupvba()
    Dim FinalRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("Sheet2")
    FinalRow = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
    Debug.Print ActiveWorkbook.Name
    Debug.Print ActiveSheet.Name
    Range("B2:B" & FinalRow).FormulaR1C1 = "=VLOOKUP(RC[-1],wsx!R2C1:R9999C2,2,FALSE)"
    End Sub

    3
    • Press F5.
    Afterward, you will have the cost values extracted in the Cost column.
    4

  18. Hi Jeff Blackwell,
    Thanks for reaching us. You can use the following code with some adjustments to split a worksheet based on column into some worksheets of the same workbook.
    Here, we will split the following worksheet based on the Month column and so the worksheet will be split into 3 different sheets – January, February, March.
    1
    • Use the following code. Adjust the starting row number in nRow = 2, the column indicating letter in (the base column on which you will split the worksheet) objWorksheet.Range(“C” & nRow).

    Sub SplitSheetIntoMultipleWorkbooksBasedOnColumn()
        Dim objWorksheet As Excel.Worksheet
        Dim nLastRow, nRow, nNextRow As Integer
        Dim strColumnValue As String
        Dim objDictionary As Object
        Dim varColumnValues As Variant
        Dim varColumnValue As Variant
        Dim xWS As Excel.Worksheet
        Set objWorksheet = ActiveSheet
        nLastRow = objWorksheet.Range("A" & objWorksheet.Rows.Count).End(xlUp).Row
        Set objDictionary = CreateObject("Scripting.Dictionary")
        For nRow = 2 To nLastRow
            strColumnValue = objWorksheet.Range("C" & nRow).Value
            If objDictionary.Exists(strColumnValue) = False Then
               objDictionary.Add strColumnValue, 1
            End If
        Next
        varColumnValues = objDictionary.Keys
        For i = LBound(varColumnValues) To UBound(varColumnValues)
            varColumnValue = varColumnValues(i)
           Set xWS = Sheets.Add(after:=Worksheets(Worksheets.Count))
            objWorksheet.Rows(1).EntireRow.Copy
            xWS.Name = varColumnValue
            xWS.Activate
            xWS.Range("A1").Select
            xWS.Paste
            For nRow = 2 To nLastRow
                If CStr(objWorksheet.Range("C" & nRow).Value) = CStr(varColumnValue) Then
                   objWorksheet.Rows(nRow).EntireRow.Copy
                   nNextRow = xWS.Range("A" & objWorksheet.Rows.Count).End(xlUp).Row + 1
                   xWS.Range("A" & nNextRow).Select
                   xWS.Paste
                   xWS.Columns("A:D").AutoFit
                End If
            Next
        Next
    End Sub

    2
    • Press F5.
    Then, you will have 3 sheets- January, February, March.
    3

  19. Hello Milad,
    Thanks for your compliment.

  20. Hi Laurene,
    Thanks for staying with us. If the net income cash flows reduced, or 0 or negative, whatever it is. The value of the argument finance rate doesn’t depend on it. You must give the rate as input which is paid by you for cash flows. When you select the payment and incomes at specified intervals as the Values argument, the finance rate as the rate paid by you for your income, and finally the reinvestment rate, the MIRR function will calculate the rate by automatically adjusting the values.

  21. Hi Raymond,
    Thanks for your question. I think you can do your task easily by following the code below.
    • Right-click on the sheet name containing your dataset and then select the View Code option.
    1
    • Type the following code in the opened window and make sure to adjust the number of Target.Column = 5 according to the column number of the emails.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 5 Then
    New_Email = Application.WorksheetFunction.Substitute(Target.Value, "gmail", "outlook")
    Target.Value = New_Email
    End If
    End Sub

    2
    • After saving the code, return to your worksheet.
    • Type a random email with @gmail.com
    3
    • Press ENTER.
    In this way, the email will be automatically changed from gmail to outlook.
    4

  22. Hello Jorge.F,
    Thank you so much for your suggestion. I think you might want the following code incorporating your suggested lines. Moreover, I tried to select the range through an input box which may help you select the range.

    Sub Insert_Blank_Rows()
    Dim rng As Range
    Dim CountRow As Integer
    Dim i As Integer
    Dim n As Integer
    Application.CutCopyMode = False
    ExcelTitleId = "Exceldemy"
    Set rng = Application.Selection
    Set rng = Application.InputBox("Select your range", ExcelTitleId, rng.Address, Type:=8)
    n = Int(InputBox("Enter the Value of n: "))
    k = Int(InputBox("Enter the Number of Blank Rows: "))
    CountRow = rng.EntireRow.Count
    Selection(1).Activate
    For i = 1 To Int(CountRow / n)
        For j = 0 To k - 1
            ActiveCell.Offset(n + j, 0).EntireRow.Insert
        Next j
        ActiveCell.Offset(n + k, 0).Select
    Next i
    
    End Sub
  23. Hello Julie,
    You can try out the following code. I think it will work for you. Just make sure to change the number in Target.Column = 3 according to your column number of data validation.

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rngDV As Range
    Dim oldVal As String
    Dim newVal As String
    If Target.Count > 1 Then GoTo exitHandler
    
    On Error Resume Next
    Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
    On Error GoTo exitHandler
    
    If rngDV Is Nothing Then GoTo exitHandler
    
    If Intersect(Target, rngDV) Is Nothing Then
    Else
      Application.EnableEvents = False
      newVal = Target.Value
      Application.Undo
      oldVal = Target.Value
      Target.Value = newVal
      If Target.Column = 3 Then
        If oldVal = "" Then
          Else
          If newVal = "" Then
          Else
          Target.Value = oldVal & ", " & newVal
    
          End If
        End If
      End If
    End If
    
    exitHandler:
      Application.EnableEvents = True
    End Sub

    1

  24. Hi Milad,
    Thanks for your question.
    According to your requirement, I have created a random dataset containing 1M records within 1M rows of a dataset in Excel. Using a VBA code, I will split it into 10 different worksheets each containing 100,000 rows.
    1
    • Type the following VBA code. Here, instead of using the InputBox method, we are directly declaring the total range and the split number in the code which will expediate running the code.

    Sub SplitExcelSheet_into_MultipleSheets()
    Dim WorkRng As Range
    Dim xRow As Range
    Dim SplitRow As Integer
    Dim xWs As Worksheet
    On Error Resume Next
    Set xWs = Range("A1:A1000000").Parent
    Set xRow = Range("A1:A1000000").Rows(1)
    Application.ScreenUpdating = False
    For i = 1 To 1000000 Step 100000
        resizeCount = 100000
        If (Range("A1:A1000000").Rows.Count - xRow.Row + 1) < 100000 Then resizeCount = Range("A1:A1000000").Rows.Count - xRow.Row + 1
        xRow.Resize(resizeCount).Copy
        Application.Worksheets.Add after:=Application.Worksheets(Application.Worksheets.Count)
        Application.ActiveSheet.Range("A1").PasteSpecial
        Set xRow = xRow.Offset(100000)
    Next
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
    End Sub

    2
    • Press F5.
    In this way, we have created 10 different sheets each with 100000 records.
    3

  25. Hi Alex,
    Here, I have shown the procedure of creating a waterfall chart for positive increments only. However, you can follow the article of this link- https://www.exceldemy.com/excel-waterfall-chart-with-negative-values/ – to create a chart with negative increment values.

  26. Hi Tushar Chauhan,
    kindly let me know which code is causing this problem.

  27. Hello Tushar Chauhan,
    Thanks for reaching us. According to your stated scenario, I have created the following dataset for some imaginary employees. Using their weekly presence and targeted presence we will calculate their weekly percentages here.
    1
    In the process of creating PivotTable, make sure to check the Add this data to the Data Model option.
    2
    • Drag down the SalesPerson and Email Id fields to the Rows area and Weekly Presence and Targeted Presence fields to the Values area.
    3
    • To add a new measure for calculating percentages right-click on the table name Range and select the Add Measure option.
    4
    • In the Measure dialog box, enter Percentage as Measure Name and use the following formula in the Formula box
    =[Sum of Weekly Presence]/[Sum of Targeted Presence]
    5
    • Choose Number as Category and then select the Percentage option.
    • Press OK.
    6
    • Drag down the newly created Percentage measure to the Values area.
    7
    Afterward, you will get the Percentage column in your PivotTable.
    8
    Now, if you change any data of your main dataset then the values of the PivotTable will be updated also.
    For instance, we have changed the values of the Weekly Presence column in the main dataset.
    9
    • Now go to the sheet with PivotTable and then go to the PivotTable Analyze tab >> Refresh group >> Refresh option.
    10
    After that, the percentages will be updated also.
    11
    To send these percentages to individual employees automatically using VBA script you can follow this article https://www.exceldemy.com/send-bulk-email-from-outlook-using-excel/
    After going through this article, you will notice different ways of doing this task.

  28. Hi Kala,
    Thanks for your question. According to your comment, you want to work with a table that’s why I have created the following table.
    dataset
    You can use the following formula
    =IF(ROW()=””,””,TODAY())
    Here, ROW() will return the corresponding row number for a row; like for Row 5, it will give the value 5, for Row 6 you will have 6.
    formula
    Then, you can insert the names in the Name column.
    result

  29. Hi Jeff V,
    Thanks for reaching us. You have informed us here that the aforementioned code is not giving your expected out. But in my case, I am getting the correct outputs by extracting data from different workbooks into one. I think yours will also work fine if you notice the following matters.
    • Firstly, copy the exact path name where your desired files are saved.
    code
    code
    • Put down the correct sheet name of your saved workbooks in the following indicated areas.
    code
    After modifying all of these factors, run your final code.
    Sub ExtractDataToDifferentSheets()
    On Error GoTo HandleError
    Application.ScreenUpdating = False
    Dim objectFlieSys As Object
    Dim objectGetFolder As Object
    Dim file As Object
    Set objectFlieSys = CreateObject(“Scripting.FileSystemObject”)
    Set objectGetFolder = objectFlieSys.GetFolder(“D:\Monthly Sales”)
    Dim counter As Integer
    counter = 1
    For Each file In objectGetFolder.Files
    Dim sourceFiles As Workbook
    Set sourceFiles = Workbooks.Open(file.Path, True, True)
    Dim rowsNumber As Integer
    rowsNumber = sourceFiles.Worksheets(“Sheet1”).UsedRange.rows.Count
    Dim colsNumber As Integer
    colsNumber = sourceFiles.Worksheets(“Sheet1”).UsedRange.Columns.Count
    Dim rows, cols As Integer
    For rows = 1 To rowsNumber
    For cols = 1 To colsNumber
    Application.Workbooks(1).ActiveSheet.Cells(rows, cols) = _
    sourceFiles.Worksheets(“Sheet1”).Cells(rows, cols)
    Next cols
    Next rows
    rows = 0
    Dim worksheetName As String
    worksheetName = Replace(sourceFiles.Name, “.xlsx”, “”)
    sourceFiles.Close False
    Set sourceFiles = Nothing
    With ActiveWorkbook
    .ActiveSheet.Name = worksheetName
    counter = counter + 1
    If counter > .Worksheets.Count Then
    .Sheets.Add After:=.Worksheets(.Worksheets.Count)
    End If
    .Worksheets(counter).Activate
    End With
    Next
    HandleError:
    Application.EnableEvents = True
    Application.ScreenUpdating = True
    End Sub

    Finally, you will get the following sheets in a single workbook.
    code

  30. Hi Andy,
    Thanks for your query. Unfortunately, using the UNIQUE function you cannot do your desired job directly. So, I have come up with an easy alternative way.
    Here, I have created the following dataset using your example. Using the PivotTable feature of Excel, I will convert the following three columns into a single column with unique values only.
    dataset
    • Press ALT+D and then P immediately to open up the PivotTable and PivotChart Wizard.
    process
    • In Step 1 of this wizard click on the options; Multiple consolidation ranges, PivotTable.
    • Click on Next.
    process
    • In Step 2a of this wizard click on the Create a single page field for me option.
    • Click on Next.
    process
    • Now, select the range of the words including a blank column prior to this range in the Range box.
    • Select Add to enter the formula of the Range box to the All ranges box.
    process
    Afterward, the formula will be entered into the All ranges box, and finally, click on Next.
    process
    • In Step 3 of this wizard click on the New worksheet option.
    • Click on Finish.
    process
    • Now, drag down the Value to the Rows area.
    Finally, all of the unique words will be listed in a single column.
    process

  31. Hello Jen,
    Thanks for your question. I think there is no direct way to fulfill your requirement using the UNIQUE function. But you can use a combination of some functions to get the unique values after comparing different columns.
    So, I have created the following dataset where I have some names of fruits in the two columns, List 1 and List 2. Here, we have some same fruits names in these two columns, and using the formula we will extract the unique values of these columns in the columns; Result 1, and Result 2.
    dataset
    For extracting the unique values of List 1, we will use the following formula in Result 1.
    =IF(ISNA(VLOOKUP(B3,$C$3:$C$9,1,FALSE)),B3,””)
    formula
    After comparing the unique values of List 2 with the values of List 1 we will use the following formula in the Result 2 column.
    =IF(ISNA(VLOOKUP(C3,$B$3:$B$9,1,FALSE)),C3,””)
    formula

  32. Hello Dan,
    Thank you so much for your appreciation. Hope you will be benefitted more by staying with our Exceldemy site.

  33. Hi David, I think maybe you have forgotten to change the name of the worksheet from another to practice while working with the practice worksheet. So, you can try out the following code to work with the practice sheet.
    Sub selectrange1()
    Dim LR As Long
    Dim x1 As Range, y1 As Range
    With ThisWorkbook.Worksheets(“practice”)
    LR = Cells(Rows.Count, “B”).End(xlUp).Row
    Application.ScreenUpdating = False
    For Each x1 In .Range(“B1:B” & LR)
    If x1.Text = “Apple” Then
    If y1 Is Nothing Then
    Set y1 = .Range(“C” & x1.Row).Resize(, 2)
    Else
    Set y1 = Union(y1, .Range(“C” & x1.Row).Resize(, 2))
    End If
    End If
    Next x1
    Application.ScreenUpdating = True
    End With
    If Not y1 Is Nothing Then y1.Select
    End Sub

  34. Hello Chandrakant, regarding your problem I have created the following two datasets where in both sheets I have your predefined text 762-V-231. After comparing the range of texts from Sheet1 with Sheet2 I will have the matched texts besides the Existing column.
    In Sheet1 I have a range of texts and after the comparison, I will have matched texts in the Similar Text column.
    dataset1
    The comparison will be done with Sheet2
    dataset2
    To do this comparison you can use the following code

    Sub find_text()
    Dim source_txt As Range, find_txt As Range
    For Each source_txt In Sheets(“Sheet1”).Range(“A2:A6”)
    For Each find_txt In Sheets(“Sheet2”).Range(“A2:A6”)
    If InStr(1, source_txt, find_txt, vbTextCompare) > 0 Then
    source_txt.Offset(0, 1) = find_txt
    Exit For
    End If
    Next
    Next
    Set source_txt = Nothing
    Set find_txt = Nothing
    End Sub

    After pressing F5, you will have the following result
    result

  35. Hello EXCELLEARNER, Thank you so much for your compliment. Hope you will stay with our site Exceldemy always.

  36. Hello Gabrielle, after going through your problem, I have understood it like this that you want to highlight those dates which are greater than 30 days (or January month) or 60 days (or February month), or 90 days (or March month) and the corresponding specific cells are blank for these dates. If the specific cells are not blank, then the coloring should be avoided. After understanding this scenario, I have created the following dataset like your sample to illustrate the process.
    dataset
    • Firstly, select the dates, and then go to the Home tab >> Conditional Formatting dropdown >> New Rule option.
    conditional
    • In the opening dialog box, choose the indicated option and then type the following formula in the box
    =AND(B2=””,OR(A2>DATEVALUE(“1/30/2022”),A2>DATEVALUE(“2/28/2022”),A2>DATEVALUE(“3/31/2022”)))
    • Click on Format
    formula
    • In the Format Cells dialog box go to the Fill tab >> select your desired color >> press OK.
    format
    Then, the following result will appear.
    result

  37. Hello Richard,
    Thanks for your question. The maximum number of sheets in a workbook is 255. So, if you have values for more than 255 rows in a sheet on the basis of which you will create multiple sheets then you may face a problem.

  38. Hello Muizz Shaikh,
    Thanks for your question. The maximum number of entries should be within the limit of the maximum row numbers of Excel which is 1,048,576. So, you can merge the files as long as the entries of the combined file support this limit.

  39. Hi Jose A. Valiente, thanks for your valuable suggestion. Actually, the third method is quite different from the first 2 methods as this method determines the P value for the correlation of the two sets of values using a correlation factor.

ExcelDemy
Logo