THE DATA SCIENCE INTERVIEW BOOK
Buy Me a Coffee ☕FollowForum
  • About
  • Log
  • Mathematical Motivation
  • STATISTICS
    • Probability Basics
    • Probability Distribution
    • Central Limit Theorem
    • Bayesian vs Frequentist Reasoning
    • Hypothesis Testing
    • ⚠️A/B test
  • MODEL BUILDING
    • Overview
    • Data
      • Scaling
      • Missing Value
      • Outlier
      • ⚠️Sampling
      • Categorical Variable
    • Hyperparameter Optimization
  • Algorithms
    • Overview
    • Bias/Variance Tradeoff
    • Regression
    • Generative vs Discriminative Models
    • Classification
    • ⚠️Clustering
    • Tree based approaches
    • Time Series Analysis
    • Anomaly Detection
    • Big O
  • NEURAL NETWORK
    • Neural Network
    • ⚠️Recurrent Neural Network
  • NLP
    • Lexical Processing
    • Syntactic Processing
    • Transformers
  • BUSINESS INTELLIGENCE
    • ⚠️Power BI
      • Charts
      • Problems
    • Visualization
  • PYTHON
    • Theoretical
    • Basics
    • Data Manipulation
    • Statistics
    • NLP
    • Algorithms from scratch
      • Linear Regression
      • Logistic Regression
    • PySpark
  • ML OPS
    • Overview
    • GIT
    • Feature Store
  • SQL
    • Basics
    • Joins
    • Temporary Datasets
    • Windows Functions
    • Time
    • Functions & Stored Proc
    • Index
    • Performance Tuning
    • Problems
  • ⚠️EXCEL
    • Excel Basics
    • Data Manipulation
    • Time and Date
    • Python in Excel
  • MACHINE LEARNING FRAMEWORKS
    • PyCaret
    • ⚠️Tensorflow
  • ANALYTICAL THINKING
    • Business Scenarios
    • ⚠️Industry Application
    • Behavioral/Management
  • Generative AI
    • Vector Database
    • LLMs
  • CHEAT SHEETS
    • NumPy
    • Pandas
    • Pyspark
    • SQL
    • Statistics
    • RegEx
    • Git
    • Power BI
    • Python Basics
    • Keras
    • R Basics
  • POLICIES
    • PRIVACY NOTICE
Powered by GitBook
On this page

Was this helpful?

  1. EXCEL

Data Manipulation

PreviousExcel BasicsNextTime and Date

Last updated 2 years ago

Was this helpful?

Excel, as a product, always remains under active development from Microsoft. With new releases, new features are brought in whereas old ones are discarded. Due to this there might be changes to the solutions mentioned below depending on the version that you are using.

SUM of digits

Can you write a formula to generate the SUM of all digits in a cell?

Answer

To use when you are sure that there are only digits in the column:

=SUMPRODUCT(--MID(B2,ROW(INDIRECT("1:"&LEN(B2))),1))

But if there are other characters too use this:

=SUMPRODUCT((LEN(B3)-LEN(SUBSTITUTE(B3,ROW(1:9),"")))*ROW(1:9))

DISTINCT & Duplicates

Given the data below, please answer the following questions

This is a 3-part question:

  • Given a table of data how do you tell if it has duplicates?

  • Create a table with distinct values from this

  • Can you do a conditional duplicate check on this table?

| Region | ID |
|--------|----|
| A      | 1  |
| B      | 2  |
| C      | 3  |
| C      | 4  |
| B      | 3  |
| C      | 4  |

Answer

You can check for duplicates using:

= COUNTIF($B$2:$B$7) Rows with value > 1 has duplicates

In order to create a table with Unique values there are 2 ways:

  • Select the table and click on remove duplicates

  • If you want to keep the source table and create the unique value table, elsewhere use:

=UNIQUE(A2:B7)

Conditional check can be done using IF clause, for example if you want to check duplicates only for ID > 3 you can use something like:

=IF(B2>3,COUNTIF($B$2:$B$7,B4),0)

⚠️