count values in a row based on criteria in a column excel
So this problem I thought could be solved with a Countif - but that function requires a 'square' array to look at. I have a list of staff names(Column with 28 rows), and a calendar with a shift type (365 columns, 10 shift types). What I am trying to do is count the instances of each shift type in a row, but keeping the row dynamic based on the staff person name. So if Bob is row 5 it will count his "D" shifts, but if I later move him to row 7 it will stay with counting his shifts.
So Staff names in Column A5:A28, Shift types in Range B5:ND28. The summary page will move around staff names from row to row so I need to be able to count shift types based on the name in Column A and match the row with that value. I am too much of a noob to embed images...
excel excel-formula
add a comment |
So this problem I thought could be solved with a Countif - but that function requires a 'square' array to look at. I have a list of staff names(Column with 28 rows), and a calendar with a shift type (365 columns, 10 shift types). What I am trying to do is count the instances of each shift type in a row, but keeping the row dynamic based on the staff person name. So if Bob is row 5 it will count his "D" shifts, but if I later move him to row 7 it will stay with counting his shifts.
So Staff names in Column A5:A28, Shift types in Range B5:ND28. The summary page will move around staff names from row to row so I need to be able to count shift types based on the name in Column A and match the row with that value. I am too much of a noob to embed images...
excel excel-formula
1
Where is your output formula? What does the current formula look like now? How are we supposed to know what shift type is supposed to be counted for each name? What about these rows with multiple shift types? There are some key pieces of your question missing here.
– dwirony
Nov 27 '18 at 17:31
So for each staff name, you want to count the occurrences of each shift type ? Or does each staff member only do one particular shift ? And where is that information ?
– Peter K.
Nov 27 '18 at 17:40
add a comment |
So this problem I thought could be solved with a Countif - but that function requires a 'square' array to look at. I have a list of staff names(Column with 28 rows), and a calendar with a shift type (365 columns, 10 shift types). What I am trying to do is count the instances of each shift type in a row, but keeping the row dynamic based on the staff person name. So if Bob is row 5 it will count his "D" shifts, but if I later move him to row 7 it will stay with counting his shifts.
So Staff names in Column A5:A28, Shift types in Range B5:ND28. The summary page will move around staff names from row to row so I need to be able to count shift types based on the name in Column A and match the row with that value. I am too much of a noob to embed images...
excel excel-formula
So this problem I thought could be solved with a Countif - but that function requires a 'square' array to look at. I have a list of staff names(Column with 28 rows), and a calendar with a shift type (365 columns, 10 shift types). What I am trying to do is count the instances of each shift type in a row, but keeping the row dynamic based on the staff person name. So if Bob is row 5 it will count his "D" shifts, but if I later move him to row 7 it will stay with counting his shifts.
So Staff names in Column A5:A28, Shift types in Range B5:ND28. The summary page will move around staff names from row to row so I need to be able to count shift types based on the name in Column A and match the row with that value. I am too much of a noob to embed images...
excel excel-formula
excel excel-formula
edited Nov 27 '18 at 17:31
Mabes
asked Nov 27 '18 at 17:27
MabesMabes
107
107
1
Where is your output formula? What does the current formula look like now? How are we supposed to know what shift type is supposed to be counted for each name? What about these rows with multiple shift types? There are some key pieces of your question missing here.
– dwirony
Nov 27 '18 at 17:31
So for each staff name, you want to count the occurrences of each shift type ? Or does each staff member only do one particular shift ? And where is that information ?
– Peter K.
Nov 27 '18 at 17:40
add a comment |
1
Where is your output formula? What does the current formula look like now? How are we supposed to know what shift type is supposed to be counted for each name? What about these rows with multiple shift types? There are some key pieces of your question missing here.
– dwirony
Nov 27 '18 at 17:31
So for each staff name, you want to count the occurrences of each shift type ? Or does each staff member only do one particular shift ? And where is that information ?
– Peter K.
Nov 27 '18 at 17:40
1
1
Where is your output formula? What does the current formula look like now? How are we supposed to know what shift type is supposed to be counted for each name? What about these rows with multiple shift types? There are some key pieces of your question missing here.
– dwirony
Nov 27 '18 at 17:31
Where is your output formula? What does the current formula look like now? How are we supposed to know what shift type is supposed to be counted for each name? What about these rows with multiple shift types? There are some key pieces of your question missing here.
– dwirony
Nov 27 '18 at 17:31
So for each staff name, you want to count the occurrences of each shift type ? Or does each staff member only do one particular shift ? And where is that information ?
– Peter K.
Nov 27 '18 at 17:40
So for each staff name, you want to count the occurrences of each shift type ? Or does each staff member only do one particular shift ? And where is that information ?
– Peter K.
Nov 27 '18 at 17:40
add a comment |
1 Answer
1
active
oldest
votes
Assuming a data setup like this:

Column L contains the name you're looking for from your grid, column M contains the Shift Type you want to count for that name, cell N2 contains this formula to get the count and is copied down:
=COUNTIF(INDEX(B:J,MATCH(L2,A:A,0),0),"*"&M2&"*")
I was going to suggest D, N, and S be column headers, and names for row names and the count as the resulting intersect values, however just realized no indication of data layout was given for input or output...great job of assuming a scenario!
– Forward Ed
Nov 27 '18 at 18:01
Many thanks stackoverflow.com/users/2665425/tigeravatar! That was the formula I was looking for. Tweaked it slightly (didn't need the wildcards) and it works like a charm!
– Mabes
Nov 28 '18 at 2:38
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53505054%2fcount-values-in-a-row-based-on-criteria-in-a-column-excel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Assuming a data setup like this:

Column L contains the name you're looking for from your grid, column M contains the Shift Type you want to count for that name, cell N2 contains this formula to get the count and is copied down:
=COUNTIF(INDEX(B:J,MATCH(L2,A:A,0),0),"*"&M2&"*")
I was going to suggest D, N, and S be column headers, and names for row names and the count as the resulting intersect values, however just realized no indication of data layout was given for input or output...great job of assuming a scenario!
– Forward Ed
Nov 27 '18 at 18:01
Many thanks stackoverflow.com/users/2665425/tigeravatar! That was the formula I was looking for. Tweaked it slightly (didn't need the wildcards) and it works like a charm!
– Mabes
Nov 28 '18 at 2:38
add a comment |
Assuming a data setup like this:

Column L contains the name you're looking for from your grid, column M contains the Shift Type you want to count for that name, cell N2 contains this formula to get the count and is copied down:
=COUNTIF(INDEX(B:J,MATCH(L2,A:A,0),0),"*"&M2&"*")
I was going to suggest D, N, and S be column headers, and names for row names and the count as the resulting intersect values, however just realized no indication of data layout was given for input or output...great job of assuming a scenario!
– Forward Ed
Nov 27 '18 at 18:01
Many thanks stackoverflow.com/users/2665425/tigeravatar! That was the formula I was looking for. Tweaked it slightly (didn't need the wildcards) and it works like a charm!
– Mabes
Nov 28 '18 at 2:38
add a comment |
Assuming a data setup like this:

Column L contains the name you're looking for from your grid, column M contains the Shift Type you want to count for that name, cell N2 contains this formula to get the count and is copied down:
=COUNTIF(INDEX(B:J,MATCH(L2,A:A,0),0),"*"&M2&"*")
Assuming a data setup like this:

Column L contains the name you're looking for from your grid, column M contains the Shift Type you want to count for that name, cell N2 contains this formula to get the count and is copied down:
=COUNTIF(INDEX(B:J,MATCH(L2,A:A,0),0),"*"&M2&"*")
answered Nov 27 '18 at 17:35
tigeravatartigeravatar
21.1k42235
21.1k42235
I was going to suggest D, N, and S be column headers, and names for row names and the count as the resulting intersect values, however just realized no indication of data layout was given for input or output...great job of assuming a scenario!
– Forward Ed
Nov 27 '18 at 18:01
Many thanks stackoverflow.com/users/2665425/tigeravatar! That was the formula I was looking for. Tweaked it slightly (didn't need the wildcards) and it works like a charm!
– Mabes
Nov 28 '18 at 2:38
add a comment |
I was going to suggest D, N, and S be column headers, and names for row names and the count as the resulting intersect values, however just realized no indication of data layout was given for input or output...great job of assuming a scenario!
– Forward Ed
Nov 27 '18 at 18:01
Many thanks stackoverflow.com/users/2665425/tigeravatar! That was the formula I was looking for. Tweaked it slightly (didn't need the wildcards) and it works like a charm!
– Mabes
Nov 28 '18 at 2:38
I was going to suggest D, N, and S be column headers, and names for row names and the count as the resulting intersect values, however just realized no indication of data layout was given for input or output...great job of assuming a scenario!
– Forward Ed
Nov 27 '18 at 18:01
I was going to suggest D, N, and S be column headers, and names for row names and the count as the resulting intersect values, however just realized no indication of data layout was given for input or output...great job of assuming a scenario!
– Forward Ed
Nov 27 '18 at 18:01
Many thanks stackoverflow.com/users/2665425/tigeravatar! That was the formula I was looking for. Tweaked it slightly (didn't need the wildcards) and it works like a charm!
– Mabes
Nov 28 '18 at 2:38
Many thanks stackoverflow.com/users/2665425/tigeravatar! That was the formula I was looking for. Tweaked it slightly (didn't need the wildcards) and it works like a charm!
– Mabes
Nov 28 '18 at 2:38
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53505054%2fcount-values-in-a-row-based-on-criteria-in-a-column-excel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Where is your output formula? What does the current formula look like now? How are we supposed to know what shift type is supposed to be counted for each name? What about these rows with multiple shift types? There are some key pieces of your question missing here.
– dwirony
Nov 27 '18 at 17:31
So for each staff name, you want to count the occurrences of each shift type ? Or does each staff member only do one particular shift ? And where is that information ?
– Peter K.
Nov 27 '18 at 17:40