學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 工具軟件 > 辦公軟件學(xué)習(xí) > Excel教程 > Excel2013教程 > Excel數(shù)據(jù)透視表如何清除原有數(shù)據(jù)項(xiàng)

Excel數(shù)據(jù)透視表如何清除原有數(shù)據(jù)項(xiàng)

時(shí)間: 錦暉1117 分享

Excel數(shù)據(jù)透視表如何清除原有數(shù)據(jù)項(xiàng)

  數(shù)據(jù)透視表的數(shù)據(jù)源可能改變, 導(dǎo)致字段下拉列表中有些無用的數(shù)據(jù)項(xiàng)存在,例如有些銷售人員已經(jīng)離開公司, 但他們的名字仍然在數(shù)據(jù)透視表的數(shù)據(jù)項(xiàng)中存在。以下是學(xué)習(xí)啦小編為您帶來的關(guān)于Excel數(shù)據(jù)透視表清除原有數(shù)據(jù)項(xiàng),希望對(duì)您有所幫助。

  Excel數(shù)據(jù)透視表清除原有數(shù)據(jù)項(xiàng)

  盡管你每次更新數(shù)據(jù)透視表后,這些名字仍然與新名字同時(shí)顯示出來. 在下面的列表中, 楊建新已經(jīng)被劉艷代替,但他的名字仍然存在。

  手動(dòng)清除原有的數(shù)據(jù)項(xiàng)

  從列表中手動(dòng)清除原有的數(shù)據(jù)項(xiàng)操作方法:

  1. 將數(shù)據(jù)透視字段拖拉到數(shù)據(jù)透視表以外的區(qū)域.

  2. 點(diǎn)擊數(shù)據(jù)透視表工具欄上的更新按鈕

  3. 將數(shù)據(jù)透視字段拖拉回到數(shù)據(jù)透視表區(qū)域

  編寫程序清除原有的數(shù)據(jù)項(xiàng) -- Excel 2002或更高版本

  在Excel 2002或更高版本中, 你可以編寫程序改變數(shù)據(jù)透視表屬性,防止遺漏顯示數(shù)據(jù)項(xiàng)或清除已經(jīng)顯示的數(shù)據(jù)項(xiàng).

  Sub DeleteMissingItems2002All()

  '防止數(shù)據(jù)透視表中顯示無用的數(shù)據(jù)項(xiàng)

  '在 Excel 2002 或更高版本中

  '如果無用的數(shù)據(jù)項(xiàng)已經(jīng)存在,

  '運(yùn)行這個(gè)宏可以更新

  Dim pt As PivotTable

  Dim ws As Worksheet

  For Each ws In ActiveWorkbook.Worksheets

  For Each pt In ws.PivotTables

  pt.PivotCache.MissingItemsLimit = xlMissingItemsNone

  Next pt

  Next ws

  End Sub

  編寫程序清除原有的數(shù)據(jù)項(xiàng)-- Excel 97/Excel 2000

  在較早的Excel版本中, 運(yùn)行下列代碼可以清除數(shù)據(jù)透視表下拉表的原有數(shù)據(jù)項(xiàng).

  Sub DeleteOldItemsWB()

  '清除數(shù)據(jù)透視表中無用的數(shù)據(jù)項(xiàng)

  ' 單位MSKB (202232)

  Dim ws As Worksheet

  Dim pt As PivotTable

  Dim pf As PivotField

  Dim pi As PivotItem

  On Error Resume Next

  For Each ws In ActiveWorkbook.Worksheets

  For Each pt In ws.PivotTables

  pt.RefreshTable

  For Each pf In pt.VisibleFields

  If pf.Name <> "Data" Then

  For Each pi In pf.PivotItems

  If pi.RecordCount = 0 And _

  Not pi.IsCalculated Then

  pi.Delete

  End If

  Next

  End If

  Next

  Next

  Next

  End Sub

猜你喜歡:

1.Excel數(shù)據(jù)透視表動(dòng)態(tài)數(shù)據(jù)怎么制作

2.怎樣在Excel2013數(shù)據(jù)透視表中統(tǒng)計(jì)不重復(fù)值數(shù)量

3.Excel如何去除無效數(shù)據(jù)

4.excel表格數(shù)據(jù)透析的方法

5.Excel中表格數(shù)據(jù)出現(xiàn)E+17修改文本的解決技巧

3738416