亞寵展、全球?qū)櫸锂a(chǎn)業(yè)風(fēng)向標(biāo)——亞洲寵物展覽會(huì)深度解析
350
2025-04-01
假設(shè)這里是一個(gè)數(shù)字列表,現(xiàn)在您可以在此列表中找到兩個(gè)數(shù)字的所有可能的總和,如下面的屏幕截圖所示? 在Excel中,沒有內(nèi)置函數(shù)可以解決此任務(wù)。 現(xiàn)在,我向您介紹一個(gè)VBA代碼來處理它。
Find all possible sums of two numbers in a list with VBA code
Find all possible combinations of two lists with List All Combinations
Find all possible sums of two numbers in a list with VBA code如果要在列表中查找兩個(gè)數(shù)字的所有可能和,可以在VBA代碼下面應(yīng)用。
1。 按 Alt + F11 鍵顯示 Microsoft Visual Basic for Applications 窗口。
2。 點(diǎn)擊 Insert > Module,將以下代碼復(fù)制并粘貼到模塊中。
VBA: List all possible sums of two numbers in a list
3。 點(diǎn)擊 Tools > References,在彈出的對(duì)話框中,選中 Microsoft Scripting Runtime 復(fù)選框。
4。 點(diǎn)擊 OK 關(guān)閉對(duì)話框,然后按 F5
要運(yùn)行代碼,將彈出一個(gè)對(duì)話框,提醒您選擇一個(gè)列表以查找可能的金額。
5。 點(diǎn)擊 OK
,則列表C中列出了列表中兩個(gè)數(shù)字的所有可能總和。
Tip:在代碼字符串Range(“ C1”)。Resize(xDic.Count,1)中,您可以根據(jù)需要將C1更改為另一個(gè)單元格。
Find all possible combinations of two lists with List All Combinations如果要查找或列出兩個(gè)列表的所有可能組合,如下面的屏幕截圖所示,則 List All Combinations 實(shí)用程序 Kutools for Excel
可以幫你一個(gè)忙。
1。 點(diǎn)擊 Kutools > Insert > List All Combinations
.
2.在 List All Combinations
對(duì)話框中,單擊選擇按鈕以選擇要合并的第一個(gè)列表。
3。 點(diǎn)擊 Add 將列表添加到 Combinations list
部分。
4.重復(fù)步驟2和3,將第二個(gè)列表添加到 Combinations list
.
5。 然后點(diǎn)擊 Ok
選擇要放置組合結(jié)果的單元格。
6。 點(diǎn)擊 OK
。 所有可能的組合已在單元格中列出。
List all combinations
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請(qǐng)聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請(qǐng)聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。