Using two Vstacks within countif?

excelNewbie22

Well-known Member
Joined
Aug 4, 2021
Messages
549
Office Version
  1. 365
Platform
  1. Windows
hi,
i'm trying to count combinations of two's from 2 ranges, and want to put it all in one formula rather using helper columns,
Excel Formula:
=SUM(COUNTIF(vstack(C3&"-"&D3,D3&"-"&E3,E3&"-"&F3,F3&"-"&G3,G3&"-"&H3, C4&"-"&D4,D4&"-"&E4,E4&"-"&F4,F4&"-"&G4,G4&"-"&H4),VSTACK(C2&"-"&D2,D2&"-"&E2,E2&"-"&F2,F2&"-"&G2,G2&"-"&H2)))
but i'm getting an error, saying "there's a problem with this formula" and etc...
any idea why?
any alternatives?

btw, one vstack works fine
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Guessing based on your formula. Try
Excel Formula:
=SUM(--ISNUMBER(XMATCH(C2:G2&"-"&D2:H2,LET(t,TOCOL(E3:H4),DROP(t,-1)&"-"&DROP(t,1)))))
 
Upvote 0
Post #2 doesn't account for duplicates. Redo:
Excel Formula:
=LET(t,TOCOL(C2:H3),SUM(--(DROP(t,-1)&"-"&DROP(t,1)=C1:G1&"-"&D1:H1)))
 
Upvote 0
Solution

Forum statistics

Threads
1,225,738
Messages
6,186,725
Members
453,368
Latest member
positivemind

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top