Advanced Excel Problems With Solutions
Advanced Excel Problems With Solutions
In this PDF file, you will get 10 advanced exercises to test your Excel prowess. You can download
the Excel file from the download section of this article. You will need to know how to separate
names, generate random numbers, calculate distance between addresses, insert pictures from
URLs, create dependent dropdown lists, find duplicate rows, combine duplicate rows, unhide
rows in a range, transpose rows to columns, and create a meter chart. Except for problem 07,
all problems can be solved using Excel 2010 or later. You will need Microsoft 365 to solve Exercise
07.
• Problem 01 Separate First, Middle, and Last Name: You need to split the first, middle,
and last name from the full name using a formula.
• Firstly, you will need to use the LEFT, SEARCH, MID, RIGHT, LEN, SUBSTITUTE, and
FIND functions to solve this problem.
• Solution 01:
o To find the First Name, =LEFT(B7,SEARCH(" ",B7)-1)
o Middle Name =MID(B7,SEARCH(" ",B7)+1,SEARCH(" ",B7,SEARCH(" ",B7)+1)-
(SEARCH(" ",B7)+1))
o Last Name =RIGHT(B7,LEN(B7)-FIND("^",SUBSTITUTE(B7," ","^",LEN(B7)-
LEN(SUBSTITUTE(B7," ","")))))
Sub Random_Number_Generator()
Dim r, c As Integer
For r = 18 To 23
For c = 3 To 5
Cells(r, c).Value = Int((90 - 50 + 1) * Rnd + 50)
Next c
Next r
End Sub
• Solution 04:
o Use this VBA code
Sub URLPhotoInsert()
Dim cPhoto As String
Dim cPicture As Shape
Dim cRange As Range
Dim cItem As Range
Set cRange = Range("D36:D38")
For Each cItem In cRange
cPhoto = cItem.Offset(0, -1)
If cPhoto = "" Then GoTo line33
Set cPicture = ActiveSheet.Shapes.AddPicture(cPhoto, _
msoFalse, msoTrue, Columns(cItem.Column).Left, _
Rows(cItem.Row).Top, -1, -1)
If cPicture.Width > cItem.Width Then cPicture.Width = cItem.Width
If cPicture.Height > cItem.Height Then cPicture.Height = cItem.Height
With cPicture
.Top = Rows(cItem.Row).Top + (Rows(cItem.Row).Height - .Height) / 2
.Left = Columns(cItem.Column).Left + (.TopLeftCell.Width - .Width) / 2
.LockAspectRatio = msoTrue
.Placement = xlMoveAndSize
End With
line33:
cPhoto = ""
Next
End Sub
• Solution 05:
o Firstly, apply Named Range. Additional data are given in the “Reference Tables”
sheet. Then, use the Data Validation feature to finish the task.
• Problem 06 Find Duplicate Rows:
o Afterward, you will highlight the duplicate rows in a range using VBA.
• Solution 06:
o Apply this VBA code
Sub DuplicateRows()
Dim cRow As Integer, i As Integer
For i = 49 To 56
For cRow = i + 1 To 56
If Range("B" & cRow) = Range("B" & i) Then
If Range("C" & cRow) = Range("C" & i) Then
If Range("D" & cRow) = Range("D" & i) Then
Range("B" & cRow & ":D" & cRow).Interior.Color = vbGreen
Range("B" & i & ":D" & i).Interior.Color = vbGreen
End If
End If
End If
Next cRow
Next i
End Sub
• Solution 07:
o Use this formula to find unique names =UNIQUE(B61:B66)
o Use this formula to find unique car maker =TEXTJOIN(",
",TRUE,UNIQUE(IF($B$61:$B$66=$B69,$C$61:$C$66,"")))
o Finally, insert this formula to combine the car model =TEXTJOIN(",
",TRUE,UNIQUE(IF($B$61:$B$66=$B69,$D$61:$D$66,"")))
• Solution 08:
o Apply this VBA code
Sub UnhideRowsFromRange()
For k = 77 To 84
Rows(k).Hidden = False
Next k
End Sub
• Solution 10:
o Follow this article to know how to create a meter chart.
If you have any confusion, please check the Excel file for this article. Moreover, you are free to
comment in our website for further assistance.