简体   繁体   中英

Excel formula to count a number in first column and output in corresponding column in same row?

Hello guys I was trying to achieve the following in Excel

A   B   C   D   E
1   1   0   0   0
0   0   0   0   0
2   0   1   0   0
1   2   0   0   0
2   0   2   0   0

So if I enter a number in A column the corresponding column to that number counts how many times the number occurred in A and outputs the same in the same row at the corresponding column. I ve tried B = COUNTIF(A1:A1000, 1) but this is useless if you know what I mean. Any ideas on how to achieve the result?

Try this formula in B1 copied down and across

=IF($A1=COLUMNS($B1:B1),COUNTIF($A$1:$A1,COLUMNS($B1:B1)),0)

That will give the results you showed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM