How to sum columns in Excel dynamically? - indexing

I have tried forever to sum up excel columns dynamically. There are several other questions on this forum on the same subject but for some reason, I dont get them to work on my data. Here is the situation (the data is just an example, the real data includes dozens columns):
I would like to sum up the total of "Apple", "Banana" and "Grapes" in B3, B4 and B5, respectively but applying a dynamic formula on the data seen in I1:K9.
I have tried using the following formula but it does not work:
=SUMIF(INDEX(I1:K10;MATCH(A3;I1:K1;0);0);A3;0)
Any help is highly appreciated since Im about to loose my mind over this haha.

If you have the newest version of Excel you can use FILTER.
=SUM(FILTER($I$1:$K$10, $I$1:$K$1=$A3))

For Office365 the suggested solution by Euler's Disgraced Stepchild is the better option.
For older versions you could use: =SUM(INDEX($I$1:$K$9,0,MATCH($A2,$I$1:$K$1,0)))

Related

How to write an excel index match formula with varying criteria?

Good day,
I have this index/match formula constructed based on a csv table i donwloaded from our office system and it's working fine:
IFERROR(INDEX('2nd'!$A$1:$D$100,MATCH("Enter BIN 1 Quantity",'2nd'!$B$1:$B$100,0),4),0)
However, I noticed that some tables i donwloaded showed different search patterns . Sometimes it's
"Enter Bin1 Qty"(no space) and there are times its just "Bin 1 Qty" or Bin1 Quantity". How can I make my formula adapt to this varying search criteria?. Your kind help will be much appreciated.
Thanks a lot in advance.
Mike
On this Final Table i will be displaying all the data from index matches formula. Got 2 other sheets, 1st and 2nd where I will paste the downloaded csv tables. 2nd sheet displays the 1st table image i posted here (w/c include the varying description and its equivalent value).
Hi #OverflowStacker, I tried your solution below but its throwing number error. Based on the above tables, here is the formula based on your solution, kindly check any problem in referencing, thanks, appreciate the help in advance (i entered it as an array as you mentioned below)
INDEX('2nd'!$D$2:$D$100,SMALL(IF(ISNUMBER(SEARCH(INDEX($T$2:$T$5,SMALL(IF(ISNUMBER(SEARCH($T$2:$T$5,SUBSTITUTE('2nd'!B2," ",""))),ROW($T$2:$T$5)),1)),SUBSTITUTE('2nd'!$B$2:$B$100," ",""))),ROW('2nd'!$B$2:$B$100)),1))
This is where i placed the possible search strings.
This is rather complicated :). It's an Array-formula CTRLSHIFTENTER
=INDEX($G$1:$G$4,SMALL(IF(ISNUMBER(SEARCH(INDEX($D$1:$D$4,SMALL(IF(ISNUMBER(SEARCH($D$1:$D$4,SUBSTITUTE(A1," ",""))),ROW($D$1:$D$4)),1)),SUBSTITUTE($F$1:$F$4," ",""))),ROW($F$1:$F$4)),1))
You can create a list with search terms (here in column D) to get right keyword which is searched for in table 2 (columns F:G).

Amateur need help on Excel multiple conditions, using arrays, etc

First question post here in this website. Using EXCEL now and in need of help in making this.
Making it short, I'm an amateur who seems to have a near impossible task on my hand now and been self-studying my way through but still came up short to the ideal results I'm looking for.
Some of the basics I get, but it seems I'm still missing something that it ends up not giving the results I want.
Here's the objective:
There are only two conditions to be met;
Using the first criteria to search, if it is "C", "D", or "E",
and the second criteria, if it is "a" or "b", to further specify.
In the DATA SHEET, the data below those criteria will be sum up and will be consolidated in the SUMMARY SHEET.
I have tried using SUMIF with the multiple criteria it can have, but there seems to be a problem when using the array B2:S2 with the cells being Merged cells. This is what I used to solve:
"=SUMIFS(Data!B4:S4,Data!B2:S2,Summary!B2,Data!B3:S3,Summary!B3)"
Looking forward to finally having a solution for this or even getting near in solving this.
DataSheet
SummarySheet
Try this...
On Summary Sheet,
In B4
=SUMPRODUCT((OFFSET(Data!$B$2:$S$2,,CHOOSE(IF(MOD(COLUMNS($B3:B3),2)=0,2,1),0,-1))=INDEX($B$2:B$2,MATCH("zzz",$B$2:B$2)))*(Data!$B$3:$S$3=B$3)*(Data!$B4:$S4))
And then copy it across and down.
Here's another answer which modifies a single part of your own function:
=SUMIFS(Data!$B4:$S4,Data!$B$2:$S$2,OFFSET($B$2,0,QUOTIENT((COLUMN()-2),2)*2),Data!$B$3:$S$3,B3)
I've just changed the criteria1 of your SUMIFS function, and freezed other cells properly.
Note: This is not an array formula.

Query several ranges and add automatically a column to know the source of each row

I am trying to achieve the following in Google Spreadsheets.
First, I want to query several ranges (in different sheets from the same spreadsheet). I tried a formula like this =query(arrayformula({indirect(E2:E10)}),"select * where Col1 <>''") with no success
In E2:E10 I have a list of ranges. Column F contains a name that describes the source of the value in Column E.
My second problem is that I need to add a column to the output of that query that tells me the origin of each row.
If the sources are ranges of 3 columns by country I need to merge those tables and add that country to each row.
All credits to +Ben Liebrand who helped me out here: https://support.google.com/docs/profile/3464
"I just want to start of by saying that the indirect() function does not work in an arrayformula() function as expected. So you will need to take another approach. I can understand what you are trying to do so I added another TAB in your spreadsheet to demonstrate another approach. I know it was initially a specific design you were trying so I made some changes to what you had. Maybe you can take a look at what I have offered and maybe you can tweak your design.
I know what I am offering is just very rough but you will also notice that I removed the end row specifier from your ranges in the range table.
Don't assume my example to be the final result but I was just trying to show that the range you were trying to use with the indirect() function will not work.
So hopefully this will give you a new idea of how you can maybe handle this.
My formula also adds the country to each of the tables in the output. My formula looks like this
=query(ArrayFormula({
if(len(indirect(regexextract(F2,"\w+\!\w+")&":A")),G2,),indirect(F2);
if(len(indirect(regexextract(F3,"\w+\!\w+")&":A")),G3,),indirect(F3);
if(len(indirect(regexextract(F4,"\w+\!\w+")&":A")),G4,),indirect(F4);
if(len(indirect(regexextract(F5,"\w+\!\w+")&":A")),G5,),indirect(F5);
if(len(indirect(regexextract(F6,"\w+\!\w+")&":A")),G6,),indirect(F6);
if(len(indirect(regexextract(F7,"\w+\!\w+")&":A")),G7,),indirect(F7)
})," select * where Col1 <> '' ")
Hope this is of some help to you"
And I hope is useful to the community
Gerónimo

Excel pivot table - wrong number ordering

I have an issue with number ordering in pivot tables. I tried almost everything... Observe:
As you can see somehow the pivot table sorts the days in a wrong order. In the data source all day values are numbers formatted as General - NOT DATES! Week numbers are number as well, again formatted as general.
Another interesting point is that a different pivot report which is using data from this file has the same issue. Note that the data is processed during the export and is converted to date using VBA DateValue function etc.
We use this report about a year now and we never had this issue before. Rebuilding the pivot table fixed the issue but in this report I have about 10 pivot tables and charts linked to VBA code, slicers, named cells etc. Rebuilding the whole file would take days.
First I´ve added a picture but my karma or whatever wasn´t good or something :)
Anyway, thank you for your comments, I´ve already figured it out so here is my answer:
I´ve just selected the row which I wanted to sort and sorted it with the basic excel sorting tool in the Home tab. So stupid...
Sorry for bothering with such a stupid question... :)

Pull data from multiple Excel sheets, count how many of a certain lead within a month

A continuation of a previous question... where I have run into another formula issue.
We have an Excel spreadsheet where we track our leads. My boss wants to know, specifically "how many leads for each month and how many of each source and the result."
The users on this forum were incredibly helpful, and gtwebb gave me this formula (thank you!):
=COUNTIF(Sheet1!A14:A21,12012)
Which worked beautifully for counting how many leads we had in each month.
Now I need to know how many leads came from the Web, SOI, VP/Sign, etc., WITHIN that month. So I'm hoping there is a formula where I can ask Excel to only look at a certain month, say 12012, and then how many leads we got from the Web or other places. I know I'll need to change our lead source for each formula, but I can't get the basic formula to work. I've tried: =countif(Sheet1!e2:e20,12012, if(Sheet1!m2:m20,Web)), and other variations on this, trying to elaborate on the original formula that worked correctly.
Thank you for your help!
A Pivot Table didn't really ring a bell with me, so I looked into a formula solution.
Pnuts posted a suggestion to try sumifs(). I could only get this to work if there was a column with "1" in it for every line.
A similar function, countifs(), seems to work. Here's a formula for counting the number of lines with a month of "12012" and a source of "Web":
=COUNTIFS(Sheet1!A:A,"=12012",Sheet1!B:B,"=Web")
It assumes that column A is month and column B is source. Good luck!
Your boss wants a Pivot Table made from the data. Unless you have other reasons for using formulas or VBA (not stated in the question), using the pivot table functionality instead will save you a lot of effort in this case.