I have two columns in my Excel sheet. Column A contains Wk No
, Column B Dates
:
Wk. No Dates 1228 9-Jul 1228 10-Jul 1228 11-Jul 1228 11-Jul 1228 12-Jul 1228 13-Jul 1229 16-Jul 1229 16-Jul 1229 17-Jul
I want the following result:
Wk. No No-of-days 1228 5 1229 2
How to get this in Excel? I can get the number of unique days but cannot control the formula to calculate unique days based on the week number.
You can use
COUNTIF(RANGE,CRITERIA)
Like
Wk.No No-of-days
1228 =COUNTIF(RANGE,<Cell Reference of 1228>)
1229 =COUNTIF(RANGE,<Cell Reference of 1229>)
If Wk. No
Wk. No
is in A1 and 1228
and 1229
in C2 and C3, respectively, then:
=SUM(IF(A2:A10=C2,1/(COUNTIFS(A2:A10,C2,B2:B10,B2:B10)),0))
entered with Ctrl + Shift + Enter and copied down one row should suit. Courtesy of Get Digital Help where a full explanation is available.
Of course would be much easier with Excel 2013.
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.