Apr 25 2020 12:49 AM
Apr 25 2020 12:49 AM
Dear All, help greatly appreciated!
I have approx 300 sections on one worksheet. Each section has 40 individual cells, each containing a value between 1 to 12 (denoting months of the year). Alongside each of these 40 cells in each section, there are 242 columns with values in them.
What I am trying to do is SUM the values in these 242 columns in the same row opposite all the 40 cells in each section containing the value 1 to 12 (denoting months of the year).
I have entered the formula =SUMIF(C8,1,D8:IK8) and the sum returned is "0", despite there being values in the cells D8:IK8. I have also tried =SUMIF(C8,"1",D8:IK8) and =SUMIF(C8, "1", D8:IY8) I think the issue maybe that the "sum range" needs to be the same as the "range".
My question is, what formula do I need to enter if the "sum range" is much larger than the "range" (in my case 244 cells vs 1 cell).
All thoughts hugely appreciated!
Best to all.
Apr 25 2020 01:10 AM
In general criteria range and sum range are to be the same size, if not Excel tries to adjust them. If you use
that means criteria range is from only one cell, and actually calculations will be done on only one cell of the sum range, i.e.
Finally, that formula is equivalent of
From your sample I didn't catch what actually you try to calculate. It only states that formula doesn't work. It works, but not as you expect.
Apr 25 2020 01:11 AM
I think you are considering the wrong formula here...what I believe you need is :#
Apr 25 2020 02:13 AM
Sergei - many thanks for your kind reply. Just to clarify, there are many thousands of cells in the worksheet that have a value entered in to the cell reserved for months (1 for Jan to 12 for Dec) and alongside each one of these "month" cells, there are 242 cells in the same row, with values in them. I then have 12 columns to the far RHS of the worksheet that totalisers for each month. Every time a "1" appears in one of the month cells, I need to add up the values in the 242 cells in the same row to the immediate right of the month cell and that total value will then appear in the January totaliser column to the far right. Hope this clarifies........all feedback welcome!
Apr 25 2020 02:13 AM
@Charla74 - many thanks for your kind reply. Just to clarify, there are many thousands of cells in the worksheet that have a value entered in to the cell reserved for months (1 for Jan to 12 for Dec) and alongside each one of these "month" cells, there are 242 cells in the same row, with values in them. I then have 12 columns to the far RHS of the worksheet that totalisers for each month. Every time a "1" appears in one of the month cells, I need to add up the values in the 242 cells in the same row to the immediate right of the month cell and that total value will then appear in the January totaliser column to the far right. Hope this clarifies........all feedback welcome!
Apr 25 2020 02:19 AM
Apr 25 2020 03:32 AM
Maybe i'm still not aligned with the result you're looking for but see attached my updated version of your sheet and an additional suggestion sheet which may (or may not) be of use.
The problem I see with your initial formula is that you are only asking for one condition (1) where there are a possible 12 conditions...
Apr 25 2020 04:02 AM
@Charla74 - many thanks again for engaging on this. We are still not quite there and that is my fault, for my poor explanation. The rows are totalising individual pieces of equipment and there are two rows for each piece of equipment. The name of the equipment is off to the left of the worksheet that I sent to you. The worksheet permits each piece of equipment to be moved up to 40 times between inventory checks. Inventory checks are annual. The idea is that this worksheet tracks the movement of equipment out of the company's stores and trucks to customers. So for each piece of equipment, I am trying to totalise the net in and out movements every month. Hence 12 columns to the far right. The column for January (tagged to the fig 1) will pick up the net movements in or out (might be 6 out and 9 in, leading to a figure of +3). The column for Feb (tagged to the fig 2 ) will pick up the net movements in or out (might be 10 out and 8 in, leading to a figure of -2)......and so on.....
Apr 25 2020 04:10 AM
Since it's not clear what are "monthly" cells, etc, let me re-word to be more close to your sample file
for the each of the months in defined in M1:X1 (Jan to Dec) we would like to calculate sum of values in each row starting from #5 and in columns from D to K. We return sum if value column C of the row is equal to month number, or zero otherwise. That's what @Charla74 suggested, but looks like not a right solution.
To map your business logic with which we are not familiar perhaps you may fill first couple of rows in above sample with data and manually added desired result in the right column. Please don't use etc. and other words instead of data - just headers and data as they are shall be for such small model.
Apr 25 2020 05:35 AM
@Sergei Baklan - apologies for my slow response. I now attach a workbook that shows a real sample of one item, copied from the original workbook. I hope that this makes it clearer. I have placed the formulas in columns GGP to GGS. The trace precedents function, seems to show that I have entered the formulas correctly, but the result is clearly wrong. Looks to me as though as you have suggested the result range is following the criteria range (i.e. one cell only).
I hate being beaten by these things....maybe we are in to VBA territory here?
Apr 25 2020 11:09 AMSolution
Perhaps formula in GGP6 could be
and copy it to the right and next rows. Other ranges could be added same way.
Apr 25 2020 08:52 PM
@Sergei Baklan - You are a legend my friend! 100% works. Thank you very much for your patience and your focus on this. Very much appreciated. I wish you and your family safe passage through this pandemic. Very best.
Apr 29 2020 06:00 AM
@Sergei Baklan - back again my friend for one more piece of advice if I may. Trying to SUM (in cell GHD10) a range of cells in the same row FXL10:GGO10 if cell FXG10 = 1 and if the corresponding criteria range of cells in Row 1 (FXL1:GGO1) = "E.D.F Sold". Seems simple enough to me, but the following formula returns the dreaded #VALUE! and not the value it should. I've gone through the syntax on the formula multiple times and cannot seem to find an issue. Is there something simple I am missing? I am entering the following formula =SUMIFS(FXL10:GGO10,FXG10,"1",FXL1:GGO1,"E.D.F Sold"). All help hugely welcome! Best
Apr 29 2020 09:57 AM
In your formula sum range and first criteria range are of different size (the latest just one cell), thus formula returns an error. If remove it as
formula returns some result. However, I guess you'd like receive this result if only FXG10 is equal to 1, when
= IF(FXG10=1,SUMIFS(FXL10:GGO10,FXL1:GGO1,"E.D.F Sold"),0)
Apr 29 2020 10:09 AM
@Sergei Baklan - OK I fully get it now. As you say sum range and criteria range need to be congruent if using SUMIF or SUMIFS. If not congruent then need to use IF at the outset and then SUMIF or SUMIFS for the congruent part of the equation. A huge thanks again my friend. I really am very grateful for yr help!! Best
Nov 13 2020 08:27 AM
@Sergei Baklan - Sergei not sure whether you are still out there and hope all well? Picking up from where I left off on this project when we were last talking in April. You kindly helped me with the following formula =IF($Q8=GHS$3,SUMIFS($R8:$IY8,$R$1:$IY$1,"*"),0). Now starting to use this piece of the worksheet, I notice that this is not quite doing what I want it to do. What I want it to do is to SUM the values only in cells where the first row of the column has the "*" in it. The above formula is not achieving this. If there is a "*" in any of the range ($R$1:$IY$1), then all values in all cells in range $R8:$IY8 are being SUM'd, rather than just the cells where the columns are "headed" with "*". Is there a small tweak required to right this formula? Many thanks Sergei!
Nov 13 2020 08:52 AM
Asterisk means any text. To use it as a character you shall use it with tilde "~*"
Above if the cell value is asterisk. If it, for example, within the text, when like "*~**"
Please check Sum if cells contain an asterisk for more details.