Hi everyone, I'm new to this site, so I apologize if this has been solved in the past, and I also apologize as I am an amateur with Excel, but I am trying to count a specific # of columns in a spreadsheet.
The concept of the spreadsheet is to display the number of occurrences of a specific criteria based on the value of another cell.
Essentially, I have a list of years going from AI to DL (82 columns of years) and a list of teams from rows 5 through 134 (130 rows of teams) and the values of the cells between these ranges are where the teams finished the season as a ranked team.
What I want my spreadsheet to display is the ability to show a specific criteria, for instance the # of times a team finished ranked #1 , but I want the return value to be determined based off of a searchable cell (for arguments sake, I currently have it set as D2) to where I can input 5 in cell D2 and Excel will count the # of times (countif formula) that the team in Row 12 (just used as an example row) finished ranked #1 during the past 5 years (because D2 is telling it to search 5 columns), and therefore it would only count 5 of the 82 columns for row 12 and also only display the number of times that team finished #1 inside of those 5 columns.
Moreover, if I then changed the searchable cell (D2) to 10, I could see how many times the team finished ranked #1 in the past 10 years, ie. it would 10 of the 82 columns, etc.
So far I've been using the COUNTIF formula, but I can't figure out how to only count a specific # of columns from the table based on the value from the searchable cell (D2).
A work around I have come up with (since again I'm very basic with Excel) is to pair it with an IF formula and sequentially list all possible outcomes someone might search in D2, but that is obviously exhausting and I would assume extremely unnecessary. So the formula that works right now would be:
=IF($D$2=1,(COUNTIF(AI5:AI5,"=1")),IF($D$2=2,(COUNTIF(AI5:AJ5,"=1")),IF($D$2=3,COUNTIF(AI5:AK5,"=1")), and so on until DL5.
I imagine there is an extremely, more condensed formula that could work here and any help would be greatly appreciated!
Thanks so much!
The concept of the spreadsheet is to display the number of occurrences of a specific criteria based on the value of another cell.
Essentially, I have a list of years going from AI to DL (82 columns of years) and a list of teams from rows 5 through 134 (130 rows of teams) and the values of the cells between these ranges are where the teams finished the season as a ranked team.
What I want my spreadsheet to display is the ability to show a specific criteria, for instance the # of times a team finished ranked #1 , but I want the return value to be determined based off of a searchable cell (for arguments sake, I currently have it set as D2) to where I can input 5 in cell D2 and Excel will count the # of times (countif formula) that the team in Row 12 (just used as an example row) finished ranked #1 during the past 5 years (because D2 is telling it to search 5 columns), and therefore it would only count 5 of the 82 columns for row 12 and also only display the number of times that team finished #1 inside of those 5 columns.
Moreover, if I then changed the searchable cell (D2) to 10, I could see how many times the team finished ranked #1 in the past 10 years, ie. it would 10 of the 82 columns, etc.
So far I've been using the COUNTIF formula, but I can't figure out how to only count a specific # of columns from the table based on the value from the searchable cell (D2).
A work around I have come up with (since again I'm very basic with Excel) is to pair it with an IF formula and sequentially list all possible outcomes someone might search in D2, but that is obviously exhausting and I would assume extremely unnecessary. So the formula that works right now would be:
=IF($D$2=1,(COUNTIF(AI5:AI5,"=1")),IF($D$2=2,(COUNTIF(AI5:AJ5,"=1")),IF($D$2=3,COUNTIF(AI5:AK5,"=1")), and so on until DL5.
I imagine there is an extremely, more condensed formula that could work here and any help would be greatly appreciated!
Thanks so much!