<!DOCTYPE html>
	<html lang="vi" xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#">
	<head>
<title>LOẠI BỎ KHOẢNG TRẮNG THỪA TRONG EXCEL, KHOẢNG TRẮNG PHÍA TRƯỚC, SAU, VÀ GIỮA CÁC TỪ</title>
<meta name="description" content="LOẠI BỎ KHOẢNG TRẮNG THỪA TRONG EXCEL, KHOẢNG TRẮNG PHÍA TRƯỚC, SAU, VÀ GIỮA CÁC TỪ - Savefile - Windows -...">
<meta name="keywords" content="windows">
<meta name="news_keywords" content="windows">
<meta name="author" content="Trường thcs Trần Quang Khải">
<meta name="copyright" content="Trường thcs Trần Quang Khải &#91;phavaphu@gmail.com&#93;">
<meta name="robots" content="index, archive, follow, noodp">
<meta name="googlebot" content="index,archive,follow,noodp">
<meta name="msnbot" content="all,index,follow">
<meta name="google-site-verification" content="RcwYmWMVb8dh-0VdAvXEp4IOHtTN12pffjnuI5mDK1o">
<meta name="generator" content="NukeViet v4.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="article:author" content="http://thcstranquangkhai.edu.vn">
<meta property="og:title" content="LOẠI BỎ KHOẢNG TRẮNG THỪA TRONG EXCEL, KHOẢNG TRẮNG PHÍA TRƯỚC, SAU, VÀ GIỮA CÁC TỪ">
<meta property="og:type" content="website">
<meta property="og:description" content="Savefile - Windows -...">
<meta property="og:site_name" content="Trường thcs Trần Quang Khải">
<meta property="og:url" content="https://thcstranquangkhai.edu.vn/index.php/vi/windows/microsoft-excel/loai-bo-khoang-trang-thua-trong-excel-khoang-trang-phia-truoc-sau-va-giua-cac-tu-239.html">
<link rel="shortcut icon" href="https://thcstranquangkhai.edu.vn/uploads/favicon.ico">
<link rel="canonical" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/microsoft-excel/loai-bo-khoang-trang-thua-trong-excel-khoang-trang-phia-truoc-sau-va-giua-cac-tu-239.html">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/" title="Windows" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thuat-thuat-bai-giang-van-phong/" title="Windows - Thuật thuật Bài giảng - Văn phòng" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/bai-giang-e-learning/" title="Windows - Bài giảng E_Learning" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/tai-lieu-su-dung-phan-mem-soan-giang-e-learning/" title="Windows - Tài liệu sử dụng phần mềm soạn giảng E_Learning" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/Tin-cong-nghe/" title="Windows - Microsoft PowerPoint" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/microsoft-word/" title="Windows - Microsoft Word" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/microsoft-excel/" title="Windows - Microsoft Excel" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/vnedu-phan-mem-nhap-diem/" title="Windows - VnEdu &#40;Phần mềm nhập điểm&#41;" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/Thu-thuat-khac/" title="Windows - Thủ thuật khác" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thu-thuat-phan-mem-internet/" title="Windows - Thủ thuật Phần mềm - Internet" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/proshow-proceducer/" title="Windows - Proshow Proceducer" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/internet/" title="Windows - Internet" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/nukeviet/" title="Windows - NukeViet" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thu-thuat-blogspot/" title="Windows - Thủ thuật Blogspot" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thu-thuat-usb/" title="Windows - Thủ thuật USB" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thu-thuat-youtube/" title="Windows - Thủ thuật Youtube" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/Download-Upload/" title="Windows - Download - Upload" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/may-chieu-projector/" title="Windows - Máy chiếu - Projector" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/photoshop/" title="Windows - Photoshop" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/driver/" title="Windows - Driver" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/mang-xa-hoi/" title="Windows - Mạng xã hội" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/Windows/" title="Windows - Windows" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-soan-bai-giang-elearning/" title="Windows - Phần mềm soạn bài giảng Elearning" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/San-pham/" title="Windows - Phần mềm SGK tin THCS" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-lop-6/" title="Windows - Phần mềm Tin lớp 6" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-lop-7/" title="Windows - Phần mềm Tin lớp 7" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-lop-8/" title="Windows - Phần mềm Tin lớp 8" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-lop-9/" title="Windows - Phần mềm Tin lớp 9" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-danh-cho-tieu-hoc/" title="Windows - Phần mềm tin dành cho Tiểu học" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-danh-cho-mam-non/" title="Windows - Phần mềm tin dành cho Mầm non" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/giang-day-hoc-tap/" title="Windows - Giảng dạy - Học tập" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tap-huan/" title="Windows - Phần mềm tập huấn" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/ung-dung-van-phong/" title="Windows - Ứng dụng Văn phòng" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-phavaphu/" title="Windows - Phần mềm phavaphu" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/he-dieu-hanh/" title="Windows - Hệ điều hành" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-khac/" title="Windows - Phần mềm khác" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/qt/" title="Windows - QT" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/ban-ghost-win/" title="Windows - Bản Ghost Win" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/lap-trinh-di-dong/" title="Windows - Lập trình di động" type="application/rss+xml">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/assets/js/jquery/jquery.min.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/wow.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/wow.min.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/theia-sticky-sidebar.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/assets/js/language/vi.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/assets/js/global.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/news.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/assets/js/jquery/jquery.cookie.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/main.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/custom.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/bootstrap.min.js">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/assets/css/font-awesome.min.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/bootstrap.non-responsive.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/style.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/style.non-responsive.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/news.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/assets/css/defaultphavaphu.vi.0.css?t=77">
<link href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/animate.css" rel="stylesheet">
<style>
	body{background: #fff;}
</style>
		<!-- BEGIN: thông báo đẩy js -->
		<!-- END: thông báo đẩy js -->
<script data-show="inline">(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-81359612-1', '.thcstranquangkhai.edu.vn');
ga('send', 'pageview');
</script>
</head>
	<body>
<div id="print">
	<div id="hd_print">
		<h2 class="pull-left">Trường thcs Trần Quang Khải</h2>
		<p class="pull-right"><a title="Trường thcs Trần Quang Khải" href="https://thcstranquangkhai.edu.vn/">https://thcstranquangkhai.edu.vn</a></p>
	</div>
	<div class="clear"></div>
	<hr />
	<div id="content">
		<h1>LOẠI BỎ KHOẢNG TRẮNG THỪA TRONG EXCEL, KHOẢNG TRẮNG PHÍA TRƯỚC, SAU, VÀ GIỮA CÁC TỪ</h1>
		<ul class="list-inline">
			<li>Thứ năm - 17/08/2017 21:20</li>
			<li class="hidden-print txtrequired"><em class="fa fa-print">&nbsp;</em><a title="In ra" href="javascript:;" onclick="window.print()">In ra</a></li>
			<li class="hidden-print txtrequired"><em class="fa fa-power-off">&nbsp;</em><a title="Đóng cửa sổ này" href="javascript:;" onclick="window.close()">Đóng cửa sổ này</a></li>
		</ul>
		<div class="clear"></div>
		<div id="hometext">
						<div class="pull-left imghome">
				<img alt="LOẠI BỎ KHOẢNG TRẮNG THỪA TRONG EXCEL, KHOẢNG TRẮNG PHÍA TRƯỚC, SAU, VÀ GIỮA CÁC TỪ" src="https://thcstranquangkhai.edu.vn/assets/windows/2017_08/remove-extra-spaces.png" width="100" class="img-thumbnail" />
			</div>
			Nếu dữ liệu của bạn có các khoảng trắng không cần thiết, hàm TRIM sẽ giúp bạn xoá bỏ tất cả – khoảng trắng phía trước, sau và giữa các từ (chỉ để lại 1 khoảng trắng) với chỉ 1 công thức duy nhất.
		</div>
		<div id="bodytext" class="clearfix">
			<p>Công thức&nbsp;<a href="https://blog.hocexcel.online/ham-trim-trong-excel.html" target="_blank">hàm TRIM</a>&nbsp;bình thường như sau:</p>

<p><strong>=TRIM(A2)</strong></p>

<p>Trong đó A2 là ô bạn muốn xoá bỏ các khoảng trắng thừa.</p>

<div style="text-align:center"><img alt="remove extra spaces" height="261" sizes="(max-width: 332px) 100vw, 332px" src="https://thcstranquangkhai.edu.vn/uploads/windows/2017_08/remove-extra-spaces.png" srcset="https://blog.hocexcel.online/wp-content/uploads/2017/05/remove-extra-spaces.png 332w, https://blog.hocexcel.online/wp-content/uploads/2017/05/remove-extra-spaces-300x236.png 300w" width="332" /></div>

<p>Như hình minh hoạ, hàm TRIM loại bỏ thành công các khoảng trắng ở đầu và cuối đoạn văn bản cũng như khoảng trắng thừa ở giữa ô.</p>

<p>Và giờ, bạn chỉ cần thay thế giá trị trong cột gốc bằng giá trị trong cột TRIM. Cách dễ nhất để làm là dùng&nbsp;<strong><em>Paste Special &gt; Values.</em></strong></p>

<p>Ngoài ra, bạn có thể dùng hàm TRIM chỉ để loại bỏ khoảng trắng phía trước, giữ lại tất cả khoảng trắng ở giữa đoạn văn bản.</p>

<h1><strong>XOÁ NGẮT DÒNG VÀ KÝ TỰ KHÔNG IN ĐƯỢC</strong></h1>

<p>Khi bạn nhập dữ liệu từ nguồn bên ngoài, không chỉ có khoảng trắng thừa xuất hiện mà còn thêm nhiều ký tự không in được như về đầu dòng (carriage return), xuống dòng (line feed), tab ngang (horizontal tab), tab dọc (vertical tab).</p>

<p>Hàm TRIM xoá hoàn toàn khoảng trắng, nhưng không thể xoá các ký tự không in được. Về mặt kỹ thuật, hàm TRIM được thiết kể chỉ để xoá ký tự 32 trong hệ thống ASCII 7-bit, tức là khoảng trắng.</p>

<p>Để loại trừ các khoảng trắng và ký tự không in được trong Excel, dùng hàm TRIM kết hợp với CLEAR. Hàm CLEAR được dùng với mục đích xoá sạch dữ liệu, và hàm này có thể xoá tất cả 32 ký tự không in được trong ASCII 7 bit (mã 0 đến 31) bao gồm cả ngắt dòng (line break – mã 10).</p>

<p>Giả sử dữ liệu cần xoá ở ô A2, công thức sẽ như sau:</p>

<p><strong>=TRIM(CLEAN(A2))</strong></p>

<div style="text-align:center"><img alt="remove nonprinting chars" height="290" sizes="(max-width: 322px) 100vw, 322px" src="https://thcstranquangkhai.edu.vn/uploads/windows/2017_08/remove-nonprinting-chars.png" srcset="https://blog.hocexcel.online/wp-content/uploads/2017/05/remove-nonprinting-chars.png 322w, https://blog.hocexcel.online/wp-content/uploads/2017/05/remove-nonprinting-chars-300x270.png 300w" width="322" /></div>

<p>Nếu công thức Trim/Clean khiến nội dung các dòng nối với nhau và mất khoảng trắng, bạn có thể sửa lỗi đó bằng 1 trong các cách sau:</p>

<ul>
	<li>Dùng chức năng&nbsp;<strong>Replace All&nbsp;</strong>của Excel: trong hộp&nbsp;<strong>Find what</strong>, nhập ký tự về đầu dòng bằng phím tắt&nbsp;<strong>Ctrl + J</strong>, và trong hộp&nbsp;<strong>Replace with</strong>, nhập khoảng trắng. Nhấn nút&nbsp;<strong>Place All</strong>&nbsp;sẽ xoá mọi dấu ngắt dòng và thay bằng khoảng trắng</li>
	<li>Dùng công thức sau để thay thế ký tự về đầu dòng (mã 13) và xuống dòng (mã 10) bằng khoảng trắng:</li>
</ul>

<p><strong>=SUBSTITUTE(SUBSTITUTE(A2, CHAR(13),” “), CHAR(10), ” “)</strong></p>

<h1><strong>XOÁ BỎ KHOẢNG TRẮNG KHÔNG NGẮT (NON-BREAKING SPACE) TRONG EXCEL</strong></h1>

<p>Nếu sau khi dùng công thức TRIM &amp; CLEAN, những khoảng trắng bướng bỉnh vẫn còn, thì có thể do bạn đã sao chép dữ liệu từ nguồn ngoài và có chứa khoảng trắng không ngắt.</p>

<p>Để loại bỏ những khoảng trắng không ngắt (ký tự html&nbsp;<em>&amp;nbsp;</em><em>) thay thế bằng khoảng trắng thường, ta có công thức hàm TRIM như sau:</em></p>

<p><strong>=TRIM(SUBSTITUTE(A2, CHAR(160), ” “))</strong></p>

<p>Để hiểu được, chúng ta cần chia nhỏ công thức trên:</p>

<ul>
	<li>Khoảng trắng không ngắt có mã 160 trong hệ thống ASCII 7-bit, do vậy bạn có thể dùng công thức CHAR(160) để biểu thị.</li>
	<li>Hàm SUBSTITUTE dùng để chuyển khoảng trắng không ngắt thành khoảng trắng thường.</li>
	<li>Và cuối cùng, bạn gộp công thức SUBSTITUTE vào hàm TRIM để xoá những khoảng trắng thường mà khoảng trắng không ngắt chuyển thành.</li>
</ul>

<p>Nếu trong bảng còn chứa cả các ký tự không in được, dùng hàm CLEAN kết hợp hàm TRIM và&nbsp;<a href="https://blog.hocexcel.online/ham-substitute-trong-excel-huong-dan-su-dung-va-co-vi-du-minh-hoa-cu-the.html" target="_blank">SUBSTITUTE</a>&nbsp;nhằm xoá những khoảng trắng và ký tự không mong muốn với 1 công thức duy nhất:</p>

<p><strong>=TRIM(CLEAN((SUBSTITUTE(A2,CHAR(160),” “))))</strong></p>

<p>Hình dưới thể hiện sự khác nhau:</p>

<div style="text-align:center"><img alt="remove nonbreaking space excel" height="221" sizes="(max-width: 633px) 100vw, 633px" src="https://thcstranquangkhai.edu.vn/uploads/windows/2017_08/remove-nonbreaking-space-excel.png" srcset="https://blog.hocexcel.online/wp-content/uploads/2017/05/remove-nonbreaking-space-excel.png 633w, https://blog.hocexcel.online/wp-content/uploads/2017/05/remove-nonbreaking-space-excel-300x105.png 300w" width="633" /></div>

<h1><strong>XOÁ 1 KÝ TỰ KHÔNG IN ĐƯỢC CỤ THỂ</strong></h1>

<p>Nếu sự kết hợp của 3 hàm trong ví dụ trên (TRIM, CLEAN và SUBSTITUTE) không thể xoá khoảng trắng và ký tự không in được trong bảng, thì có nghĩa trong bảng chứa ký tự có mã ASCII ngoài khoảng 0 đến 32 (ký tự không in được) và khác 160 (khoảng trắng không ngắt).</p>

<p>Trong trường hợp này, dùng hàm CODE để xác định mã ký tự, sau đó dùng SUBTITUTE thay thế ký tự đó bằng khoảng trắng thường và TRIM để xoá khoảng trắng.</p>

<p>Giả sử khoảng trắng hoặc những ký tự khó chịu mà bạn muốn loại trừ ở trong ô A2, bạn viết 2 công thức:</p>

<ol>
	<li>Trông ô B2, phát hiện mã ký tự bằng cách sử dụng 1 trong những công thức CODE:</li>
</ol>

<ul>
	<li>Khoảng trắng hoặc ký tự không in được ở đầu chuỗi văn bản:</li>
</ul>

<p><strong>=CODE(LEFT(A2,1))</strong></p>

<ul>
	<li>Khoảng trắng hoặc ký tự không in được ở cuối chuỗi văn bản:</li>
</ul>

<p><strong>=CODE(RIGHT(A2,1))</strong></p>

<ul>
	<li>Khoảng trắng hoặc ký tự không in được ở giữa chuỗi văn bản,&nbsp;<em>n</em>&nbsp;là vị trí của ký tự:</li>
</ul>

<p><strong>=CODE(MID(A2, n, 1)))</strong></p>

<p>Trong ví dụ này, chúng ta có ký tự không in được chưa biết mã ở giữa chuỗi văn bản, ở vị trí thứ 4, với công thức sau ta sẽ tìm ra mã của ký tự đó:</p>

<p><strong>=CODE(MID(A2,4,1))</strong></p>

<p>Hàm CODE trả kết quả là mã 127 (xem hình dưới)</p>

<ol start="2">
	<li>Nếu trong ô C2, bạn thay thế CHAR(127) bằng khoảng trắng thường (“”), và rồi loại bỏ khoảng trắng đó:</li>
</ol>

<p><strong>=TRIM(SUBSTITUTE(A2, CHAR(127), ” “))</strong></p>

<p>Kết quả sẽ giống như sau:</p>

<div style="text-align:center"><img alt="delete nonprinting char" height="145" sizes="(max-width: 507px) 100vw, 507px" src="https://thcstranquangkhai.edu.vn/uploads/windows/2017_08/delete-nonprinting-char.png" srcset="https://blog.hocexcel.online/wp-content/uploads/2017/05/delete-nonprinting-char.png 507w, https://blog.hocexcel.online/wp-content/uploads/2017/05/delete-nonprinting-char-300x86.png 300w" width="507" /></div>

<p>Nếu dữ liệu của bạn có một vài ký tự không in được khác nhau như khoảng trắng không ngắt, bạn có thể lồng 2 hoặc nhiều hàm SUBSTITUTE để xoá các ký tự không mong muốn trong 1 lần.</p>

<p><strong>=TRIM(SUBSTITUTE(SUBSTITUTE(A2, CHAR(127), ” “), CHAR(160), ” “)))</strong></p>

<div style="text-align:center"><img alt="nonbreaking space nonprinting char" height="106" sizes="(max-width: 426px) 100vw, 426px" src="https://thcstranquangkhai.edu.vn/uploads/windows/2017_08/nonbreaking-space-nonprinting-char.png" srcset="https://blog.hocexcel.online/wp-content/uploads/2017/05/nonbreaking-space-nonprinting-char.png 426w, https://blog.hocexcel.online/wp-content/uploads/2017/05/nonbreaking-space-nonprinting-char-300x75.png 300w" width="426" /></div>

<h1><strong>XOÁ MỌI KHOẢNG TRẮNG TRONG EXCEL</strong></h1>

<p>Trong một số trường hợp, bạn muốn xoá mọi khoảng trắng trong 1 ô, bao gồm cả khoảng trắng giữa các chữ và số. Ví dụ như khi bạn nhập 1 cột số, khoảng trắng để cách hàng nghìn, giúp đọc các số lớn dễ hơn, nhưng ngăn bạn dùng công thức để tính toán.</p>

<p>Để xoá tất cả khoảng trắng trong 1 lần, dùng SUBSTITUTE như trong ví dụ trên, điểm khác duy nhất là bạn thay thế khoảng trắng với mã CHAR(32) bằng không (“”).</p>

<p><strong>=SUBSTITUTE(A2, CHAR(32), “”)</strong></p>

<p>Hoặc bạn để khoảng trắng trong dấu ngoặc kép (“ “), như sau:</p>

<p><strong>=SUBSTITUTE(A2,” “,””)</strong></p>

<div style="text-align:center"><img alt="remove all spaces excel" height="142" src="https://thcstranquangkhai.edu.vn/uploads/windows/2017_08/remove-all-spaces-excel.png" width="286" /></div>

<p>Sau đó, thay thế công thức với các giá trị và các con số của bạn sẽ được tính toán chính xác.</p>

<p>&nbsp;</p>

<h1><strong>ĐẾM KHOẢNG TRẮNG TRONG EXCEL</strong></h1>

<p>Trước khi loại bỏ các khoảng trắng trong 1 ô nhất định, bạn có thể tò mò muốn biết có bao nhiêu khoảng trắng trong ô đó.</p>

<p>Để có được số khoảng trắng trong 1 ô, làm các bước sau:</p>

<ul>
	<li>Tính toán độ dài của chuỗi văn bản dùng hàm&nbsp;<strong>LEN: LEN(A2)</strong></li>
	<li>Thay thế mọi khoảng trắng bằng không:&nbsp;<strong>SUBSTITUTE(A2,” “,””)</strong></li>
	<li>Tính độ dài của chuỗi văn bản khi không có khoảng trắng:&nbsp;<strong>LEN(SUBSTITUTE(A2,” “,””))</strong></li>
	<li>Lấy tổng độ dài chuỗi văn bản trừ đi độ dài của chuỗi không có khoảng trắng.</li>
</ul>

<p>Giả sử chuỗi văn bản gốc ở trong ô A2, công thức hoàn chỉnh như sau:</p>

<p><strong>=LEN(A2)-LEN(SUBSTITUTE(A2,” “,””))</strong></p>

<p>Để tìm ra có bao nhiêu khoảng trắng thừa trong ô, lấy độ dài chuỗi văn bản khi không có khoảng trắng thừa, sau đó lấy tổng độ dài chuỗi trừ đi con số vừa tìm được:</p>

<p><strong>=LEN(A2)-LEN(TRIM(A2))</strong></p>

<p>Hình dưới minh hoạ cả 2 công thức:</p>

<div style="text-align:center"><img alt="count spaces excel" height="244" sizes="(max-width: 535px) 100vw, 535px" src="https://thcstranquangkhai.edu.vn/uploads/windows/2017_08/count-spaces-excel.png" srcset="https://blog.hocexcel.online/wp-content/uploads/2017/05/count-spaces-excel.png 535w, https://blog.hocexcel.online/wp-content/uploads/2017/05/count-spaces-excel-300x137.png 300w" width="535" /></div>

<p>Khi bạn biết có bao nhiêu khoảng trắng trong mỗi ô, bạn có thể xoá khoảng trắng thừa bằng cách dùng hàm TRIM.</p>
		</div>
	</div>
	<div id="footer" class="clearfix">
		<div id="url">
			<strong>URL của bản tin này: </strong><a href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/microsoft-excel/loai-bo-khoang-trang-thua-trong-excel-khoang-trang-phia-truoc-sau-va-giua-cac-tu-239.html" title="LOẠI BỎ KHOẢNG TRẮNG THỪA TRONG EXCEL, KHOẢNG TRẮNG PHÍA TRƯỚC, SAU, VÀ GIỮA CÁC TỪ">https://thcstranquangkhai.edu.vn/index.php/vi/windows/microsoft-excel/loai-bo-khoang-trang-thua-trong-excel-khoang-trang-phia-truoc-sau-va-giua-cac-tu-239.html</a>

		</div>
		<div class="clear"></div>
		<div class="copyright">
			&copy; Trường thcs Trần Quang Khải
		</div>
		<div id="contact">
			<a href="mailto:phavaphu@gmail.com">phavaphu@gmail.com</a>
		</div>
	</div>
</div>
        <div id="timeoutsess" class="chromeframe">
            Bạn đã không sử dụng Site, <a onclick="timeoutsesscancel();" href="https://thcstranquangkhai.edu.vn/#">Bấm vào đây để duy trì trạng thái đăng nhập</a>. Thời gian chờ: <span id="secField"> 60 </span> giây
        </div>
        <div id="openidResult" class="nv-alert" style="display:none"></div>
        <div id="openidBt" data-result="" data-redirect=""></div>
<div id="run_cronjobs" style="visibility:hidden;display:none;"><img alt="" src="/index.php?second=cronjobs&amp;p=i7TBi62L" width="1" height="1" /></div>
<script src="https://thcstranquangkhai.edu.vn/assets/js/jquery/jquery.min.js"></script>
<script>var nv_base_siteurl="/",nv_lang_data="vi",nv_lang_interface="vi",nv_name_variable="nv",nv_fc_variable="op",nv_lang_variable="language",nv_module_name="windows",nv_func_name="savefile",nv_is_user=0, nv_my_ofs=7,nv_my_abbr="+07",nv_cookie_prefix="nv4c_y197C",nv_check_pass_mstime=1738000,nv_area_admin=0,nv_safemode=0,theme_responsive=0,nv_is_recaptcha=0;</script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/wow.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/wow.min.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/theia-sticky-sidebar.js"></script>
<script src="https://thcstranquangkhai.edu.vn/assets/js/language/vi.js"></script>
<script src="https://thcstranquangkhai.edu.vn/assets/js/global.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/news.js"></script>
<script src="https://thcstranquangkhai.edu.vn/assets/js/jquery/jquery.cookie.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/main.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/custom.js"></script>
<script type="text/javascript">
    (function(p,u,s,h){
        p._pcq=p._pcq||[];
        p._pcq.push(['_currentTime',Date.now()]);
        s=u.createElement('script');
        s.type='text/javascript';
        s.async=true;
        s.src='https://cdn.pushcrew.com/js/00454aebdd272f8e4c5a5b5e50ac4513.js';
        h=u.getElementsByTagName('script')[0];
        h.parentNode.insertBefore(s,h);
    })(window,document);
</script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/bootstrap.min.js"></script>
</body>
</html>