Project 2 - Create a report using PowerQuery, Macro VBA, List Functions and Data Validation functions for Data Reporting of Supply Chain Management companies
GOOGLE DRIVE LINK: https://drive.google.com/file/d/16k-pi_4AmI3fAaw-7GzN_fr3kxzKrclT/view?usp=share_link
Filter function filter the value based on criteria we given
=filter(array,include,[if empty])
filter(b1:d307512,b1:b307512="f","no results") -> it gives the values of female's income and loan amount
Sort function sorts the values based on rowor col we given
=sort(array,[sort index],[sort order],[by row])
[sort order]-> 1-ascending; -1 - descending:
[by row] =false; [by col]=true
=sort(H1:J307512,2,1) -> It gives sorted values based on income amount
Unique function returns unique value of 3 rows.
=unique(H1:J307512,false,false)
VBA Code to convert excel file to pdf:
Sub PDFActiveSheet()
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim myFile As Variant
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
strTime = Format(Now(), "yyyymmdd\_hhmm")
'get active workbook folder, if saved
strPath = wbA.Path
If strPath = "" Then
strPath = Application.DefaultFilePath
End If
strPath = strPath & "\"
'replace spaces and periods in sheet name
strName = Replace(wsA.Name, " ", "")
strName = Replace(strName, ".", "_")
'create default name for savng file
strFile = strName & "_" & strTime & ".pdf"
strPathFile = strPath & strFile
'use can enter name and
' select folder for file
myFile = Application.GetSaveAsFilename _
(InitialFileName:=strPathFile, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
'export to PDF if a folder was selected
If myFile <> "False" Then
wsA.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=myFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
'confirmation message with file info
MsgBox "PDF file has been created: " _
& vbCrLf _
& myFile
End If
exitHandler:
Exit Sub
errHandler:
MsgBox "Could not create PDF file"
Resume exitHandler
End Sub
VBA code to check spelling mistakes:
Public Sub check_spell()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If Not Application.CheckSpelling(word:=cell.Text) Then
cell.Style = "bad"
End If
Next
End Sub