Excel - sum base on row and multiple columns - excel-2010

How to get sum of column labels 15 and 8 of a particular date
Input:
Output: need for all rows
One way is do sum along horizontal yet not sure to match the dates... I have >50K columns in real dataset. sumif along rows link https://exceljet.net/formula/sumifs-with-horizontal-range

you can write this in the cell where you want the result of first row:
=FIRSTCELL + SECONDCELL + THIRDCELL ecc...
where firstcell is like "A3"..
after simply select the cell where you got the result, a dot appears in the lower right of the cell, drag it down, and in the cells below you will get the result of the other rows

Related

Find range of last used cell in row, calculate distance and offset to display cell contents of first cell in the found range's column

This may be an iterative of this question. This would be an easy VBA task, but I believe this is more than doable using formulae. I have a general idea of how to achieve this but may be overthinking, I'm sure there is a more elegant way to do this than what I have so far.
I have a row of dates in row 1 containing values such as "1/31/2021", "2/31/2021", and so on. Below this are text values -- some cells are blank, others have basic text like "abc123" (there will never be a scenario where there are blank cells between text cells, so false positives are not a concern). My goal is to find the range of the last used cell in a row, then display the cell contents of the first cell in that column to find an appropriate date. What I have so far manages to find the last used row, and I am able to use offset to display the appropriate date, but I am looking for a solution that is scaleable, so that the formula can be used in a series of descending rows and will always correctly calculate the distance between the last used cell in each row and the contents of the first row in the result's column.
Below is what I have to find the last used cell in a row:
=INDEX(2:2,MATCH("zzzz",2:2))
This is what I have to find the last used cell in a row and offset to the cell in row 1 in the found column. This works for just row 2 as the distance between row 2 and row 1 is known. It would be ideal to offset by a dynamic value to always find the first cell in the column:
=OFFSET(INDEX(2:2,MATCH("zzzz",2:2)),-1,0)
To find the first cell in the last column of a specific row:
=INDEX($1:$1,0,MATCH("zzzz",2:2))
This will return the value in row 1 in the last column with a value in row 2.

How to count groups of cells with specific first and last characters wrapping those groups in Google Sheets?

I'm trying to count how many cells are included in specific groups of cells with specific first and last character as counting criteria.
With separate counts per group.
Here's what the end result should look like:
So that for each group of cells beginning and ending with the character "#" as first and last character,
the result should sum the cells/rows from the 1st cell to the last cell of that group.
So that for each group of cells beginning and ending with the character "^" as first and last character,
the result should sum the cells/rows from the 1st cell to the last cell of that group.
But the formula should exclude from count any group of cells not beginning and ending with the characters "^" or "#" as first and last character.
And ideally, display the sum result on the last cell of each group to the left (as in the B column on the above screenshot).
Up to now, I've only come up with the =ROWS() function to manually count the cells of those groups. But it is tedious.
For example, to deal with the screenshot example I would do:
=ROWS(C3:C5) (with 3 as result in cell B5)
Then
=ROWS(C8:C10) (with 3 as result in cell B10)
Nothing in cell B15
Then
=ROWS(C23:C25) (with 3 as result in cell B25)
Etc.
How to get these results with a single formula over the whole B column?
In the meantime I've found this post:
Sum vertically until empty cell on Google Sheets
Which answers partially the count part of my post.
It got me thinking and I figured these 3 steps.
1st step: count all the cells with len.
=IF(len(C2),1,"")
2nd Step: Adapt the formula:
IF(C2="",SUM(C3:INDEX(C3:C,MATCH(TRUE,(C3:C=""),0))),"")
Found on the post above, to this (taking into account more than one intermediary blank row (D1, D2, D3, D4, etc):
=IFS(OR(AND(D1="",D2="",D3="",D4=""),AND(D1="",D2="",D3=""),AND(D1="",D2=""),D1=""),SUM(D2:INDEX(D2:D,MATCH(TRUE,(D2:D=""),0))),TRUE,"")
Step 3: Moving down the step 2 formula into cell F4 and dragging down from there to have the results at the last cell of each groups (instead of on the cell above each group as with the original formula location on E2)
Remaining questions:
How to specify the sum function to operate on the specific characters ("#" and "^" on the example) basis instead of on the len Function of cell criteria?
How to change the zero cells results to blanks?
How to combine the 2/3 steps formulas into a single step formula?
Here's a copy of the spreadsheet if need be:
4:How to count groups of cells with specific first and last characters wrapping those groups in Google Sheets?
Alternatively, following this post's answer by #shawnrad:
Count rows with not empty value
I used the LEFT and RIGHT functions here:
=IF((OR(LEFT(C1,1)="#",RIGHT(C1,1)="#",LEFT(C1,1)="^",RIGHT(C1,1)="^")),1,"")
to come to these results:
=IF(OR(COUNTIF(C2,"#*"),COUNTIF(C2,"*#"),COUNTIF(C2,"^*"),COUNTIF(C2,"*^")),1,"")
How to then apply the SUM function or any other function to sum the cells/rows per intervals between (and including) the returned results of the last function?

Google Sheets show rows with multiple matching cells

I'm needing a formula that gives me the value of the "I" cell if other cells in the row match specific values.
For instance, based on the image I've linked below, if I looked for the results of rows where B=5, C=2, D=2, E=1, and H=F, it would give me the I cell values for rows 12 and 15 (3.03 and 3.63).
Maybe:
=QUERY(A:I,"SELECT I WHERE B=5 and C=2 and D=2 and E=1 and H='F'")
Untested as I can't be bothered to key in what you did not bother to provide as text.

How to write a formula that would work in different rows?

I'm trying to make a Google spreadsheet where I want the sum of the values in the row to appear in the AH cell of that row.
The row would be populated with letters like L or X and I'm using COUNTIF to give value to the alphabet characters.
For example,
=COUNTIF(C4:AG4,"X")*9 + COUNTIF(C4:AG4,"L")*12
How can I write the range such that it looks at cells C through AG from the same row the formula is in rather than change it for every row?
You don't need to change the formula, if you write that formula in one cell and then you drag the little square at the bottom right of the cell, excel will automatically change the row number
Just copy downwards:
As you see, the row index changed to 5 automatically.

Formula to find last value in row and label with Column Top

I'm using Google Spreadsheets. I'll be using this image from a very similar question.
http://i.imgur.com/jqcNW.png [a link]Google Spreadsheet Formula to get last value in a row
Instead of giving the value, I want the Column top to show. So the H column would look something like: 2 1 3 1 4
(The product numbers from Row 1)
If it helps =index(B2:G2;1;counta(B2:G2)) was the answer given to the original question. My values would be words instead of numbers. It'd need to track the last 'Yes' in the row with the column top being dates.
I think this should be easy:
=index($B$1:$G$1;1;counta(B2:G2)) - if you write this to the H2 cell, it should search the "N"th element in the FIRST row ($B$1:$G$1) - where N represents the value of non-empty cells in that row (B2:G2).
You can then populate this H2 formula downwards.
Let me know if this helps.

Resources