COUNTIF function based on cell value from drop-down list

Pete298

New Member
Joined
May 12, 2016
Messages
2
Hi all,

On my first sheet I have a drop-down list that selects which week of the year we are on (17, 18, 19, etc.).
Then on the second sheet, each week is broken down into 5 days, 1,2,3,4,5. The cell above these 5 is merged with the contents "week 18" for example.

I want to be able to select the week from the drop down list, then excel uses a formula to search the relevant 5 columns and count all the letter "m" within those columns, essentially those that fall under that week header.

Can anybody help please? Not sure best way to approach this. Have tried vlookups, hlookups, indexes and matches, countif, defined name ranges, etc.

Thanks,
Pete
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi, try the below. Where A2 is the week value from your dropdown list and sheet2!2:11 is the where you want to count anything that has "m" in it.

=IF(COUNTIF(Sheet2!1:1,"*"&A2&"*")>0, COUNTIF(Sheet2!2:11,"*m*"),"")
 
Upvote 0
also possible

=IF(ISNUMBER(SEARCH(A2,Sheet2!1:1)),COUNTIF(Sheet2!2:8,"*m"),"No Values")
 
Upvote 0
Hi Barry,

Neither of these have worked. the first just returns a blank cell and then the second just returns "No Values". It seems like the 'search' for the week number does not locate in the second sheet?

I'm looking for a formula where the 5 days of week 18 are the columns F to J, and the formula searches for the week number and then looks within these specific 5 columns for the letter "m".

Can you provide more assistance please?

Thanks,
Pete
 
Upvote 0

Forum statistics

Threads
1,216,074
Messages
6,128,649
Members
449,462
Latest member
Chislobog

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