Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Ok I am working on an excel spread sheet to collect data from 3 shifts. In column D the shift is listed such as 1A, 2B, and 3C and the totals are listed in column AC. Now I would like to average them out by shift. Here is the if statement i tried to use.
I would like the data for 1A to show in field AF2 and 2b to show up in Af3 and 3C to show up in AF4.=IF(D:D="1A",AF2= AF2 +AC:AC,AF2)
This is just for the 1A shift.

If what you want to do is add up the values in column AC associated with a particular value in column D, then you probably want to use the SUMIF function.
Per the Excel help files, the syntax is as follows:
SUMIF(range,criteria,sum_range)
In your case, for 1A, I believe you should put this in AF2 (which, BTW, is a cell not a field):
=SUMIF(D:D,"=1A",AC:AC)
If you want the average of the values in AC associated with 1A, you have a couple of options.
You can divide the sum of the values associated with 1A by the number of values associated with 1A:
=SUMIF(D:D,"=1A",AC:AC)/COUNTIF(D:D,"=1A")
or you can use an array formula such as:
{=AVERAGE(IF(D1:D25="1A",AC1:AC25))}
2 notes:
1- You have to specify a specific range for the array, e.g. D1:D25. You can't use D:D or AC:AC.
2 - You enter the formula by using Ctrl-Shift-Enter to get the brackets and make it an array formula. You can't just type in the {} and expect it to work. If you just hit Enter, you may get an answer, but it won't be correct.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |