# count values where two columns match

Options
edited 12/09/19

i am trying to count the number of matching pairs of values in two columns.

eg:

Column A         Column B

1910                 760

1910                 810

1910                 810

1990                 760

1990                 760

the outcome of the above that i am looking for is as follows

1910 x 760 = 1

1910 x 810 = 2

1990 x 760 = 2

Regards

• Employee
Options

Hello,

Try a COUNTIFS statement; example:

=COUNTIFS([Column A]:[Column A], 1910, [Column B]:[Column B], 760)

You'll want to create a separate COUNTIFS formula for each pair combination that you want to count.

More on COUNTIFS here: https://help.smartsheet.com/function/countifs

• Options

awesome, thanks Shaine

• Options

what if the number of variables are significant? in this case we are dealing with measurements and although the width measurements are more of a finite range, the height measurements will vary enourmously. would i then have to have a count if statement for each millimetre difference???

• Options

what if the number of variables are significant? in this case we are dealing with measurements and although the width measurements are more of a finite range, the height measurements will vary enourmously. would i then have to have a count if statement for each millimetre difference???

• Options

Hi Shane,

Regards

Blair

• Employee
Options

Hi Blair,

You may be able to use comparative operators to count ranges of values. An example of this in a COUNTIF function is as follows:

=COUNTIF(Height:Height, > 25)

You can expand this to COUNTIFS but creating range of values to count between:

=COUNTIFS(Height:Height, > 25, Height:Height, < 250)

This formula will count any value greater than 25 but less than 250. More on COUNTIFS and acceptable operators here: https://help.smartsheet.com/function/countifs

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!