Data Analytics Visualization 1
Data Analytics Visualization 1
Visualization
Assignment 1
Submitted To:
Submitted By:
Answer:
Here's the syntax to use the MATCH function in Excel, along with an explanation of each
argument:
- lookup_value: This is the value you want to find within the lookup_array. It can be a specific
value, a cell reference, or a formula that evaluates to a value.
- lookup_array: This is the range of cells or an array where you want to search for the
lookup_value. The lookup_array should be in ascending order if you are using a match_type of 1
or -1.
- match_type (optional): This argument specifies the type of match you want to perform. It can
be one of the following values:
- 0 (Exact match): This is the default value if match_type is not specified. It looks for an exact
match of the lookup_value within the lookup_array.
- 1 (Less than or equal to): It finds the largest value in the lookup_array that is less than or equal
to the lookup_value.
- -1 (Greater than or equal to): It finds the smallest value in the lookup_array that is greater than
or equal to the lookup_value.
Now, let's see an example to understand the usage of the MATCH function in Excel:
Suppose you have a list of student names in cells A2:A6, and you want to find the position of the
name "John" within this list. You can use the MATCH function as follows:
=MATCH("John", A2:A6, 0)
Here:
- The lookup_value is "John", which is the name we want to find.
- The lookup_array is A2:A6, which is the range where we want to search for "John".
- The match_type is 0, indicating an exact match.
When you enter this formula in a cell and press Enter, Excel will search for "John" within the
range A2:A6 and return the position of the first occurrence of "John" in the list.
If "John" is in cell A4, the MATCH function will return 3 because "John" is the third item in the
list.
Note that if the lookup_value is not found in the lookup_array, the MATCH function will return
an error value, typically #N/A. You can handle such cases using error handling functions like
IFERROR or ISERROR to display a custom message or perform alternate actions.
Question 2:
Write one syntax to use the CONCATENATE function in excel.
Answer:
The CONCATENATE function in Excel is used to join or concatenate multiple text strings into a
single string. Here's the syntax along with an explanation of each parameter:
Syntax:
=CONCATENATE(text1, text2, ...)
Parameters:
- "text1", "text2", etc.: These are the text or cell references that you want to concatenate together.
You can specify up to 255 text arguments.
Example:
Suppose you have the following values in cells A1, B1, and C1:
A1: "Hello"
B1: " "
C1: "World!"
To concatenate these values into a single string, you can use the CONCATENATE function as
follows:
The function will combine the text from cell A1, the space from cell B1, and the text from cell
C1, resulting in the output: "Hello World!".
You can also use cell references directly as parameters in the CONCATENATE function. For
example:
Alternatively, starting from Excel 2016, you can use the ampersand (&) operator as a shorthand
for concatenation. The previous example using the ampersand operator would look like this:
Both the CONCATENATE function and the ampersand operator achieve the same result of
combining text strings in Excel.
Question 3:
Illustrate exact, approximate and wildcard match in Match function in Excel. How INDEX
and MATCH function combined overcome the drawback of VLOOKUP function?
Answer:
The MATCH function in Excel can be used to perform exact, approximate, and wildcard
matches. Here's an explanation of each type:
1. Exact Match:
The exact match is the default behavior of the MATCH function when no additional argument is
specified. It searches for a specific value in a range and returns the position of the matching
value.
Syntax:
=MATCH(lookup_value, lookup_array, [match_type])
Example:
Suppose you have a list of fruits in cells A1 to A5, and you want to find the position of "Apple"
in the list. You can use the MATCH function with an exact match:
=MATCH("Apple", A1:A5, 0)
The function will return the position of "Apple" in the range A1:A5, such as 3 if "Apple" is in
cell A3.
2. Approximate Match:
An approximate match is used when the data is sorted in ascending order. The MATCH function
finds the largest value that is less than or equal to the lookup value.
Syntax:
=MATCH(lookup_value, lookup_array, 1)
Example:
Suppose you have a sorted list of numbers in cells A1 to A5, and you want to find the position of
7 in the list. You can use the MATCH function with an approximate match:
=MATCH(7, A1:A5, 1)
The function will return the position of the largest value less than or equal to 7, such as 4 if the
list is [2, 5, 6, 8, 10].
3. Wildcard Match:
Wildcard match is used when you want to match a value with a specific pattern using wildcard
characters (* or ?).
Syntax:
=MATCH(lookup_value&"*", lookup_array, 0)
Example:
Suppose you have a list of names in cells A1 to A5, and you want to find the position of names
that start with "J". You can use the MATCH function with a wildcard match:
The function will return the position of the first name that starts with "J", such as 2 if the list is
["John", "Jane", "Michael", "Jason", "Jessica"].
By using INDEX and MATCH together, you can perform a vertical or horizontal lookup and
retrieve values from any column in the table based on the matching criteria.
Syntax:
=INDEX(return_range, MATCH(lookup_value, lookup_array, [match_type]))
Example:
Suppose you have a table with student names in column A, and their corresponding grades in
column B. You want to retrieve the grade of a specific student using their name. You can use the
following formula:
The INDEX function returns the value from column B, while the MATCH function finds the
position of "John" in column A. This combination allows you to retrieve the corresponding grade
for "John".
Overall, combining INDEX and MATCH provides greater flexibility and versatility compared to
VLOOKUP, as it allows for both vertical and horizontal lookups and works with unsorted data.
Question 4:
Define the term Macro. Where can we use Macro in Microsoft Excel. Discuss its use case in
your latest projects.
Answer:
A macro in Microsoft Excel is a sequence of instructions or actions that can be recorded,
programmed, and executed to automate repetitive tasks or perform complex operations. It allows
users to automate processes, manipulate data, perform calculations, and interact with various
Excel features.
Macros in Excel are typically created using the Visual Basic for Applications (VBA)
programming language, which is built into Excel. VBA provides a powerful and flexible
platform for creating macros, allowing users to write custom code to control Excel's
functionality.
2. Data Manipulation and Analysis: Macros can be used to perform complex data manipulation
and analysis tasks. For instance, a macro can be created to sort and filter data, perform
calculations, generate reports, and visualize data using charts and graphs.
3. Formatting and Presentation: Macros can automate formatting tasks to ensure consistency
and save time. For example, a macro can be used to apply predefined formatting styles, adjust
column widths, insert headers and footers, and create visually appealing dashboards.
4. Custom Functions and Add-Ins: Macros can be used to create custom functions and add-ins
in Excel. These functions can be designed to perform specific calculations or tasks that are not
available in the standard Excel functions.
5. User Interface and Interactivity: Macros can enhance the user interface and provide
interactivity in Excel workbooks. For instance, macros can be used to create custom menus,
buttons, and dialog boxes that allow users to interact with and control various features and
functionalities.
By creating macros, I was able to automate the entire process, eliminating the need for manual
data entry and manipulation. The macros imported data from various file formats, standardized
the data structure, performed calculations based on predefined rules, and generated reports with
dynamic charts and tables.
The macros not only saved significant time and effort but also ensured accuracy and consistency
in the data and reports. They allowed for quick updates and modifications as the project
requirements evolved, providing a scalable and efficient solution.
Overall, macros played a crucial role in streamlining the data consolidation and reporting
process, improving productivity, and enabling effective data analysis and decision-making.
Question 5:
Explain Inbuilt Data Structures of python with example demonstration?
Answer:
Python provides several built-in data structures that are widely used for storing and organizing
data. The main built-in data structures in Python are lists, tuples, sets, and dictionaries. Here's a
brief explanation of each data structure along with an example demonstration:
1. Lists:
A list is an ordered collection of items enclosed in square brackets ([]). It allows for storing
multiple values of different types and is mutable, meaning its elements can be modified.
Example:
```python
fruits = ['apple', 'banana', 'orange']
print(fruits) # Output: ['apple', 'banana', 'orange']
# Accessing elements
print(fruits[0]) # Output: 'apple'
# Modifying elements
fruits[1] = 'grape'
print(fruits) # Output: ['apple', 'grape', 'orange']
# Adding elements
fruits.append('mango')
print(fruits) # Output: ['apple', 'grape', 'orange', 'mango']
# Removing elements
fruits.remove('orange')
print(fruits) # Output: ['apple', 'grape', 'mango']
```
2. Tuples:
A tuple is an ordered collection of items enclosed in parentheses (()).
It is similar to a list, but it is immutable, meaning its elements cannot be modified once defined.
Example:
```python
person = ('John', 25, 'USA')
print(person) # Output: ('John', 25, 'USA')
# Accessing elements
print(person[0]) # Output: 'John'
# Unpacking tuple
name, age, country = person
print(name, age, country) # Output: 'John', 25, 'USA'
```
3. Sets:
A set is an unordered collection of unique elements enclosed in curly braces ({}). It does not
allow duplicate values.
Example:
```python
fruits = {'apple', 'banana', 'orange'}
print(fruits) # Output: {'apple', 'banana', 'orange'}
# Adding elements
fruits.add('mango')
print(fruits) # Output: {'apple', 'banana', 'orange', 'mango'}
# Removing elements
fruits.remove('banana')
print(fruits) # Output: {'apple', 'orange'}
```
4. Dictionaries:
A dictionary is an unordered collection of key-value pairs enclosed in curly braces ({}). Each
element in a dictionary is accessed by its key rather than its index. Dictionaries are mutable.
Example:
```python
student = {
'name': 'John',
'age': 20,
'country': 'USA'
}
print(student) # Output: {'name': 'John', 'age': 20, 'country': 'USA'}
# Accessing elements
print(student['name']) # Output: 'John'
# Modifying elements
student['age'] = 21
print(student) # Output: {'name': 'John', 'age': 21, 'country': 'USA'}
# Adding elements
student['grade'] = 'A'
print(student) # Output: {'name': 'John', 'age': 21, 'country': 'USA', 'grade': 'A'}
# Removing elements
del student['country']
print(student) # Output: {'name': 'John', 'age': 21, 'grade': 'A'}
```
These built-in data structures in Python provide flexibility and functionality for various data
storage and manipulation needs. They can be combined with other programming concepts to
solve a wide range of problems efficiently.
Question 5:
Explain Inbuilt Data Structures of python with example demonstration?
Answer:
Here's a Python program that iterates over a given list, counts the occurrence of each element,
and creates a dictionary to show the count of each element:
```python
sample_list = [11, 45, 8, 11, 23, 45, 23, 45, 89]
The program iterates over the given list `sample_list` using a `for` loop. For each item in the list,
it checks if the item already exists as a key in the `count_dict` dictionary. If it does, it increments
the count by 1. If it doesn't exist, it adds the item to the dictionary with an initial count of 1.
Finally, it prints the resulting dictionary showing the count of each element in the list. In this
example, the output is `{11: 2, 45: 3, 8: 1, 23: 2, 89: 1}` indicating that 11 occurs twice, 45
occurs three times, 8 occurs once, 23 occurs twice, and 89 occurs once in the given list.