Featured Posts

CS50 Python , Nutrition Facts Table

Image
Nutrition Facts: Python Practice for Beginners Nutrition Facts Table for Python Practice Welcome to this comprehensive guide for Python beginners! If you are learning how to work with lists, dictionaries, and loops, this post will help you build practical skills using a real-world example: nutrition facts for fruits. Understanding how to organize and manipulate data is a key part of programming, and this exercise will give you hands-on experience. Below is a sample table of fruits and their calorie values, formatted as a Python list of dictionaries. This structure is ideal for coding exercises, projects, or even building your own nutrition calculator. You can expand this list, add new fruits, or use it as a foundation for more advanced Python tasks. Python List of Dictionaries Example: fruits = [ {'name': 'Apple', 'calories': 130}, {'name': 'Avocado', 'calories': 50}, {'name': 'Banana', 'ca...

How to Remove Spaces from an Excel String Cell

Document

 Easy Formulas to Remove Spaces

How to use Excel formulas to remove leading, trailing, and extra spaces
Excel formulas to remove spaces and clean your data efficiently.

Simply, the paces inside an Excel string Cell are either:

  • leading/starting spaces
  • Mid spaces
  • Trailing/ending spaces
Plus, if you are exporting the data from the internet or a database, you may have some problematic characters (unprintable or 7-bit ASCI characters). We will handle this too.

✋ Before we start, we will assume that the data is in cell A1. We will insert the formulas starting from B1.Feel free to change cells reference to your references.

How to remove all extra spaces from an Excel cell?

This will include leading, mid, and trailing spaces

=TRIM(A1)

or

=SUBSTITUTE(A1," ","")

Remove Spaces and Clean Unprintable Characters

=TRIM(CLEAN(A1))

You may still see characters like(� , ⌷ , ¶) which are called "unprintable characters". How to remove them? 

 Most famous codes for the unprintable characters are:

  • char(160) → �
  • char(127) → ⌷
  • char(182) → ¶

To remove these characters, you add them inside a SUBSTITUTE function (or a nested SUBSTITUTE function).
We will assume that we both � and ⌷ inside our string cell. So, we must have 2 SUBSTITUTE functions nested for each. Remember: � is char(160), ⌷ is char(127).

=TRIM(CLEAN(SUBSTITUTE(SUBSTITUTE(A2,CHAR(160),""),CHAR(127),"")))


And a bonus:

How to delete blank rows with keyboard shortcuts:

How to quickly delete blank rows in Excel using Go To Special
Step-by-step guide to delete blank rows and clean your Excel dataset.

  1. Click on top of the column to highlight it all. or, inside any cell of the column Ctrl+Spacebar
  2. Press F5
  3. Click on Special
  4. Click on Blanks
  5. Press on Ctrl+-
  6. Choose "Entire row" and press ok or Enter


Comments

Popular posts from this blog

فرصتك للدراسة في ألمانيا: منحة ممولة بالكامل لطلاب الدراسات العليا

How to Deactivate Screen Reader in Kali Linux

Murphy's Law: Expect the Unexpected

Python 3.2.1.14 LAB: Essentials of the while loop

Data Analysis Roadmap 2026: From Excel Lover to Python-Powered Analyst