SUMIFS help if there is a + sign

K0st4din

Active Member
Joined
Feb 8, 2012
Messages
488
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Hello, everyone,
I ask for your help to correct the formula, because I have a condition that is a little different and that's where my problem comes from.
I will attach a photo to see the columns I work with and respectively the end result, which gives me an error in adding the numbers when they are +
If we take BISO5 - the result should be = 360, but because in some places I have two words and two numbers, respectively, the end result is = 305, which is not true.
The formula I made is calculated, but when it is missing (or it is independent).
Please for some assistance how in the same table, to calculate correctly, if possible, of course!
Thank you in advance!
2021-02-18_142543.jpg
 
If you are interested in a helper cell approach, the following demonstrates how it could be done. Somewhere to the right of your main data table, two blocks of formulas are used to split the category codes cells (column J) and values cells (column P) into separate columns. The column headers refer to the item number to be extracted from those source cells. This sample assumes that up to six items might be included in the cell, but it can be extended further if needed. To stay below character limits on this post, I've included just the top 24 rows, but the helper formulas are extended down the entire length of your data block.
feb21.xlsx
BDJPQRSTUVWXYZAAABACADANAOAPAQAR
1namedatekkkpoint1234561234564/1/202010/30/2020Dave Tonimostripro
2Dave Toni5/19/2020RUS1015RUS10     15000000MOXI5
3Dave Toni10/20/2020BISO510BISO5     10000000MOXI7
4Dave Toni10/20/2020RUS1015RUS10     15000000LEV5
5Dave Toni10/6/2020BISO510BISO5     10000000LEV7
6Dave Toni9/21/2020BISO510BISO5     1000000120AMLF10
7Dave Toni8/17/2020BISO5+AMLF1010+15BISO5AMLF10    101500009AMLF5
8Dave Toni5/11/2020RUS1015RUS10     15000000AMOL5/40
9Dave Toni5/20/2020RUS1015RUS10     15000000AMV5/160
10Dave Toni7/2/2020BISO510BISO5     1000000350BISO5
11Dave Toni10/5/2020BISO510BISO5     10000000CANDF16
12Dave Toni10/5/2020RUS1015RUS10     15000000CLOP
13Dave Toni9/30/2020BISO510BISO5     10000000COXI200
14Dave Toni10/7/2020BISO50BISO5     0000000DOXA2
15Dave Toni10/6/2020RUS1015RUS10     15000000DOXA4
16Dave Toni9/16/2020BISO510BISO5     10000000IND1.5SR
17Dave Toni10/22/2020RUS1015RUS10     15000000IRB150
18Dave Toni8/4/2020BISO5+AMLF1010+15BISO5AMLF10    101500000IRB300
19Dave Toni43970BISO510BISO5     10000000LERC10
20Dave Toni44032BISO510BISO5     10000000LOSF50/12.5
21Dave Toni44091RUS1015RUS10     15000000NEBIF5
22Dave Toni44062BISO510BISO5     1000000330RUS10
23Dave Toni43966BISO510BISO5     10000000VALCO160/12.5
24Dave Toni44133BISO510BISO5     10000000VALF160
Sheet1
Cell Formulas
RangeFormula
R2:W24R2=TRIM(MID(SUBSTITUTE($J2,"+",REPT(" ",LEN($J2))),(R$1-1)*LEN($J2)+1,LEN($J2)))
X2:AC24X2=IFERROR(VALUE(TRIM(MID(SUBSTITUTE($P2,"+",REPT(" ",LEN($P2))),(X$1-1)*LEN($P2)+1,LEN($P2)))),0)
AQ2:AQ24AQ2=SUMPRODUCT(($D$2:$D$65>=$AN$1)*($D$2:$D$65<=$AO$1)*($B$2:$B$65=$AP$1)*($R$2:$W$65=$AR2)*($X$2:$AC$65))
 
Last edited:
Upvote 0
Solution

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Здравейте, благодаря ви много за съдействието. Напълно разбирам, че този знак + създава много проблеми. Разбира се, аз също съм склонен към някакъв макрос да свърша цялата тази работа, защото имам 28 работни листа и във всеки ще изпълнявам това действие поотделно. Също така ще тествам предложените формули, за да сравня резултатите. Що се отнася до това колко думи би могло да има и съответно точки, то е в пъти различно, но минимумът е 1, максимумът може да бъде 20.
Оставям въпроса си отворен, защото баща ми е починал и ще ми трябва известно време, за да се справя с гробищата, погребенията и всичко останало. Тогава ще пиша веднага. Благодаря ти много!
 
Upvote 0
Hello, thank you very much for your cooperation. I fully understand that this + sign creates a lot of problems. Of course, I'm also prone to some macro to do all this work, because I have 28 worksheets and in each I will perform this action separately. I will also test the proposed formulas to compare the results. As for how many words there could be and respectively points, it is many times different, but the minimum is 1, the maximum can be 20.
I leave my question open because my father has died and it will take me some time to deal with cemeteries, funerals and everything else. Then I will write immediately. Thank you very much!
 
Upvote 0
Thank you for the update. I'm sorry for your loss. When the time is right and you re-visit this, have a look at Post #21 where helper columns are used. You will probably need to move the columns very far to the right and expand them to two blocks of 20 columns each to accommodate the maximum number of category codes (the first set of 20 columns) and their corresponding values (the second set of 20 columns). I think this approach might work for you, but with 28 worksheets, a VBA solution is probably the preferred option.
 
Upvote 0
Hello KRice,
in the case of the last post everything is as it should be, but it turns out that you are very right to be done with a macro, because, these formulas will load an awful lot of excel table and it in 28 worksheets.
There is only one detail about the formula in AQ
This $AP$1 must be a variable, ie $AP1, because after checking the given name on all words, then down continues with other names that will also be checked for points on given words. The idea is to compare $AP1, $AP2, $AP3 and so on. In this way, the table will do its calculations and will not fill the table with formulas that constantly load it
=SUMPRODUCT(($D$2:$D$65>=$AN$1)*($D$2:$D$65<=$AO$1)*($B$2:$B$65=$AP$1)*($R$2:$W$65=$AR2)*($X$2:$AC$65))
And the macro, if you can do it so that I can write in which worksheet to use it and accordingly be able to rearrange the columns and rows and we will test it.
Thank you very much for understanding my father and for your help!
I wish you good health and much happiness! See you soon!
 
Upvote 0
OK, I assumed that your summary would be based on a query involving a date range, a single individual's name, and all of the category codes. And if you wanted a summary for a different individual, you could simply change the name in one cell ($AP$1). That would allow for a more compact summary table. However, if you plan to list multiple sets of all of the category codes many times in the same column, and each repeated set of category codes applies to a different individual, then it makes sense to repeat the individual's name on each row beside the category code (like the example in your post #1 where Dave Toni begins in $AP2. To me, this seems like more work because you would have to scroll down the column to the next set of codes and enter another person's name beside that set, and so on. And if the number of category codes changes, you would have to shift the category codes down/up to accommodate additions/deletions to the multiple lists. How you decide to do that is, of course, your choice. Just be sure the formula (or script) references the correct name.

I have doubts that I can develop a VBA solution for this, but others here may be able to offer some assistance. I think the formula solution described in Post #21 serves as an example of what needs to be done conceptually. The challenge involves splitting the J and P columns so that the query can be made...and that might involve up to 20 items separated by + signs in the J and P columns. But before the effort is undertaken, could you say something more about the number of individuals who will be summarized? Would it make more sense to have a single list of category codes in one column, and then place the individuals' names in cells at the top of the worksheet in different, adjacent columns, so that each column represents a summary for whomever is named at the top of the column? If that were done, how many names would need to be accommodated by a worksheet?
 
Upvote 0
Hello
my idea is the following:
I will adjust the words, I will put my names, I will also choose the dates (because each time the period is different).
As for whether the name cell should be constant, I'm not OK. But it will definitely be easier for me to filter Dave Toni and look at all the specifics of what's going on with him, and then filter my next name.
Here the idea if a macro is made - is for it to perform all the other calculations - starting with what you suggested first - the division and then the scoring according to - date, name, words, as the macro must complete the operation when reaching the last name found in a given worksheet, after which I will go to the next worksheet (I will change the name of the worksheet in the macro itself and continue until the 28th). The other option is for the macro to work under the condition (with one button in each worksheet) in the Active worksheet (things happen again).
P.S - Just to add, no matter how many names are written, the words for each name will be the same - that is, if I have 15 words for Dave, for the next name, they will be again those written by me 15 and so on until the last name in one worksheet.
 
Last edited:
Upvote 0
I was suggesting that this type of display might be beneficial...you fill in the date range of interest (green cells) and then type in the names (red cells). The formulas or the VBA code would then return the sums corresponding to the category code words for that date range and person (blue cells).
feb21.xlsx
ANAOAPAQAR
14/1/202010/30/2020Dave ToniName2Name3
2promostrimostrimostri
3MOXI50
4MOXI70
5LEV50
6LEV70
7AMLF10120
8AMLF59
9AMOL5/400
10AMV5/1600
11BISO5350
12CANDF160
13CLOP0
14COXI2000
15DOXA20
16DOXA40
17IND1.5SR0
18IRB1500
19IRB3000
20LERC100
21LOSF50/12.50
22NEBIF50
23RUS10330
24VALCO160/12.50
25VALF1600
Sheet1
 
Upvote 0
Like this...I made one change to the name on row 7:
feb21.xlsx
BDJP
1namedatekkkpoint
2Dave Toni5/19/2020RUS1015
3Dave Toni10/20/2020BISO510
4Dave Toni10/20/2020RUS1015
5Dave Toni10/6/2020BISO510
6Dave Toni9/21/2020BISO510
7Mikhail8/17/2020BISO5+AMLF1010+15
8Dave Toni5/11/2020RUS1015
Sheet1


And without any additional helper columns, and a small change to the formula so that the name refers to the one at the top of the column, the sums for the second name are returned:
feb21.xlsx
ANAOAPAQ
14/1/202010/30/2020Dave ToniMikhail
2promostrimostri
3MOXI500
4MOXI700
5LEV500
6LEV700
7AMLF1010515
8AMLF590
9AMOL5/4000
10AMV5/16000
11BISO534010
12CANDF1600
13CLOP00
14COXI20000
15DOXA200
16DOXA400
17IND1.5SR00
18IRB15000
19IRB30000
20LERC1000
21LOSF50/12.500
22NEBIF500
23RUS103300
24VALCO160/12.500
25VALF16000
Sheet1
Cell Formulas
RangeFormula
AP3:AQ25AP3=SUMPRODUCT(($D$2:$D$65>=$AN$1)*($D$2:$D$65<=$AO$1)*($B$2:$B$65=AP$1)*($R$2:$W$65=$AO3)*($X$2:$AC$65))
 
Upvote 0
And without any additional helper columns, and a small change to the formula so that the name refers to the one at the top of the column, the sums for the second name are returned:
Hello again,
the idea is good, but in the following columns, I have other information that I removed in the example.
As for the last comment, the values shown are not true for AMLF10 (is 120, no 105) and BISO5 (is 350, no 340)
I don't know why they diverge!?
P.S - Aha, the name has been changed so the result changes, it has not been added but has been changed.
So everything is correct!
 
Upvote 0

Forum statistics

Threads
1,215,840
Messages
6,127,219
Members
449,370
Latest member
kaiuuu

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