15,716 questions
0
votes
0
answers
166
views
As part of a function, how could I create a variable number of sums one inside another based on a parameter?
I'm currently struggling on an assignment (probability class) which require creating a function (VBA excel) that contains a variable number of sums one inside the other based on a parameter. I'm not ...
1
vote
1
answer
50
views
Excel formula for Sumif and query generation
In my Excel file, I have two sheets. One is named Airjet and contains detailed data with numerous columns:
Column I lists all the months
column Z lists the yarn counts
I want to extract data into ...
0
votes
1
answer
44
views
Totals from specific parts of a large spreadsheet by row and column
Here is a large spreadsheet with several years' worth of data in a lot of categories.
Y = year, M = month, D = day
A B C D E
1| Y | M | D | 1 | 2 |... Initial dataset
2| 19 | 1 | 1 | ...
0
votes
2
answers
73
views
How create a dynamic cumulative sum in power query
I want to create a sum in power query (Measure C below) returns the cumulative sum of Measure A + Measure B and is limited to zero and which resets at the beginning of each Period as shown in the ...
2
votes
1
answer
202
views
How to filter and sum elements of a matrix in MATLAB based on multiple conditions without a loop?
I have the following numeric matrix in MATLAB:
A = [3 2 7; 9 1 4; 5 6 8];
I want to sum all elements that are greater than 5 and are also even.
I need to do this without using a loop, and store the ...
0
votes
0
answers
62
views
Sum of integer data and numeric data is unexpected numeric value, R [duplicate]
Why is the sum of the iaea_mass_dat_trunc$AM_WN (integer) and iaea_mass_dat_trunc$AM_frac (numeric) 499496.6 for all results? How do I get the appropriate result (for example, the sum of the values in ...
0
votes
1
answer
123
views
Python lambda returns 0 [closed]
Is there a simple way to return 0 with a lambda function using and and or operators?
For example, consider this function to sum elements in an array:
sum = lambda tab: tab == [] and 0 or tab[0] + sum(...
2
votes
3
answers
127
views
Query count & sum nested selects into a Grouped Category
My current project/issue is we have a list of permit types. With these types they are needing to be grouped by an overall category. Once grouped out the end goal is to count how many within specified ...
4
votes
2
answers
214
views
Sum the vectors stored in the list using Rcpp
Suppose I have the following list of vector
List <- list(c(1:3), c(4:6), c(7:9))
To get the required result I have the following code in Rcpp
totalCpp <- {"#include <Rcpp.h>
using ...
0
votes
2
answers
72
views
SAS: Conditionally summing a column without having the lead funtion
I cannot conditionally sum a column where the condition looks at rows further down the table. Below is what I am expecting:
Identifier
MONTH
Sum_Me_Pls
On_Off_Flag
focus
seq
Need
1
May-23
0
0
0
1
1
...
0
votes
1
answer
141
views
How to sum two columns and calculate their average in BigQuery?
I'm working with Google BigQuery and I have a table with two numeric columns: grade1 and grade2. I want to calculate the total sum of both columns combined (row-wise) and then find the average of ...
2
votes
1
answer
77
views
Is there a more elegant way to write sum in MATLAB code
disto_pow = spectral_pow(h_idx * 2) + spectral_pow(h_idx * 3) + spectral_pow(h_idx * 4) + spectral_pow(h_idx * 5) + spectral_pow(h_idx * 6);
spectral_pow is an array and h_idx is a scalar.
Is there a ...
0
votes
1
answer
140
views
NEW QUESTION: How do I use SUMIFS with IMPORT RANGE in google sheets to sum a column based on referenced criteria (ex: "<="$K$5)?
UPDATED EDITS BELOW
I have a list of downloaded transactions that each correspond to a specific account code? I want to sum the amount (column G) based on the following criteria: segment (column A), ...
0
votes
0
answers
27
views
Sum of vlookups with a partial match: What is the formula, if it exists?
I'm trying to see if this is even possible. I am essentially trying to get a partial match vlookup with the added component of possibly a sumifs formula to get the total amount of pay for each store.
...
2
votes
3
answers
143
views
Double aggregation function
I have the result of a subquery:
SELECT
maker, p.type, COUNT(DISTINCT pc.model) pcs
FROM
Product p
INNER JOIN
Pc pc ON p.model = pc.model
GROUP BY
maker, p.type
UNION
SELECT
...
-4
votes
1
answer
80
views
Summing numbers in Kotlin [closed]
fun main() {
var numbers =("1,2,3,4,5,6")
val result = numbers . sum ()
println ("$result ")
}
I wanted to calculate these numbers with the sum function, but it ...
0
votes
1
answer
94
views
Why is SQL SUM function returning wrong values using SqLite3 and Dbeaver
I have been taking a SQL course and am in the final project, which started to use SQLite3 on DBeaver. Previously the SQL prompts were written in the course using SQLite.
When trying the aggergate ...
1
vote
2
answers
84
views
Exclude column in sapply(dat_clean, FUN = function(x){x / sum(x)}) in R
I'm working on a piece of R code to calculate the diversity in a dataset of fungal taxonomies. The tutorial I'm following has a piece of code meant to sum each row, which isn't working because the ...
1
vote
2
answers
106
views
Excel spillrange with sum
SUM(FILTER(Tbl_Assets[WDV on Year 0],(Tbl_Assets[Asset Group as per Co. Act (SCH II)]=Q14)*((Tbl_Assets[Disposal Date]>StartDate)+(Tbl_Assets[Disposal Date]=0)),0))
In the above formula, if I try ...
1
vote
1
answer
66
views
Combining Sum with Vlookup
I have this data (table 1) :
Column A
1999
5000
6666
And there's table 2 :
Col.C | Col.D (range)| Col.E (margin)
1000 | 1000 - 1260 | 830
1261 | 1261 - 1261 | 0
1262 | 1262 - 1513 | 830
...
0
votes
0
answers
37
views
Python Pandas, groupby and sum over another column [duplicate]
I have one dataframe with columns A, B, C, D, E. I would like to groupby over columns A and B, and, for each value of E, perform a sum over C and D. Something like:
for each e in E:
df[E == e]....
-1
votes
3
answers
106
views
Sum of multiple datatable columns
I want to get the sum of only two columns for each data row in datable and display it in datagridView. I tried to use link query:
SqlCommand cmd = new SqlCommand("SELECT * FROM Student", con)...
0
votes
1
answer
125
views
Why can't SymPy calculate the Sum(1 / ((k + 1) ** 4 + 1), (k,-oo,oo)) when it appears to converge?
I'm using Sympy for some numeric calculations, specifically for infinite summations. The following code returns 0:
import sympy as sp
from sympy.abc import k
sp.summation(1 / ((k + 1) ** 4 + 1), (k, -...
1
vote
1
answer
46
views
shell script to sum numbers
I have the following data:
KEY v2025.10: user1 0/2 at 03/06 14:00 (handle: e01)
KEY v2025.10: user1 1/2 at 03/06 14:01 (handle: f01)
KEY v2025.10: user2 0/1 at 03/06 14:01 (handle: 1001)
KEY v2025....
1
vote
5
answers
126
views
How do I sum up each month for all 12 months in one query
The query I work with works with YEAR and MONTH to get one SUM for each date:
EKA = CONVERT(DECIMAL(10,0),
(SELECT ISNULL(SUM(LP.QTY), 0)
FROM Invoice LP
WHERE LP.ARTICLE = A.ARTICLE
...
1
vote
2
answers
89
views
SQL Server sum over partition by
I have a fact table and I am using sum over partition by on the column vacant. I want to sum vacant when vacant is above 0. I have the following query:
SELECT
f.[D_Building_Id],
f.[...
0
votes
0
answers
37
views
Parent/Child sum when each parent has different number of children (and the excel is formatted poorly)
I've looked all week for a solution to this - would love some help.
I inherited a (maybe poorly designed) excel.
I would like the cells in the blue highlighted line to sum the values for the month ...
0
votes
1
answer
85
views
How to count number of tabs containing a word - VBA
I'm trying to figure out how to check which tabs contain a certain word and to count these instances.
I have it set up currently that when a "client" is lost, their data tab is renamed to ...
0
votes
0
answers
53
views
Why does PHP sum values of similar array items differently? [duplicate]
Laravel 8 , php 8
I saw a very strange thing in Laravel and actually in PHP that I can't understand why this is happening in PHP.
I have two arrays that are almost identical and have only one very ...
2
votes
1
answer
96
views
How to perform row aggregation across the largest x columns in a polars data frame?
I have a data frame with 6 value columns and I want to sum the largest 3 of them. I also want to create an ID matrix to identify which columns were included in the sum.
So the initial data frame may ...
-2
votes
4
answers
272
views
How to sum up to a specific value in Google Sheets
I have a complicated situation in Google Sheets and I don't know if it there is a possible solution for this in sheets. I have a list of records with various values both positive and negative, the ...
0
votes
2
answers
90
views
For loop in R to assign a vector where each element is the sum of a data set's column. First element of vector = sum of first column
Really new to R and not sure if i'm grabbing the correct column. Im using for loop to read each column 1 by 1 but when I print totals im just getting how many columns there are
setwd("~/Desktop&...
1
vote
1
answer
91
views
Count in specific ways in Google sheets
I am working on getting some specific counts but cannot figure out how to do it.
I have the following sheet:
Duration for subject 1 is 30 min and 90 min for subject 3
Subject 1
Subject 1
Subject 1
...
0
votes
1
answer
66
views
Error in "across( )" when summing multiple columns in R
Using the following data:
Distance <- data.frame(
DAY = c("1", "2","3")
,TEMP = c(25, 27, 26.5)
,C1Dist01 = c(1, 1, 1)
,C2Dist01 = c(1, 1, 0)
,C3Dist01 =...
2
votes
3
answers
101
views
how to sum cells/ struct in matlab
I am trying to add vertically the lists of a database like DB (see below) contained in a cell.
DB={ {[11 12]} {[13 14]} {[15 16]} {[17 18]} {[19 20]};
{[21 22]} {[23 24]} {[25 26]} {[27 28]} {[...
-3
votes
1
answer
67
views
Sum based on a criterion
I have a data sheet where I want to do a calculation until I find a zero in one specific column. Then I want to sum all the results of this calculation up to that zero and save the result in an array. ...
0
votes
2
answers
104
views
Calculating a value by summing several rows
Table contains data about hotel rooms.
We can see the same Room available for different date periods - at different Prices. AccmdMenTypeCode - is the Code that shows how many people can stay in this ...
1
vote
2
answers
132
views
Spill formula to sumifs by row & col for only relevant months
I have a loosely formatted table that has People going across the top, tasks going down the rows, and a column for start date and column for End Date. The user will input expected hours in the given ...
0
votes
2
answers
43
views
Sum up and Convert a Dataframe
I hope someone can help me with the following problem.
My dataframe is organized with insect species in the columns and locations in the rows like:
Species A
Species B
Species C
Location A
0
1
...
0
votes
0
answers
28
views
Combination of ffil and sum in Pandas dataframe [duplicate]
I am stuck with the following problem and would greatly appreciate much help. I have a dataframe as follows:
df = pd.DataFrame({'id': [1,1,1,1,1,1,1,2,2,2],
'date':['31.01.2012', '...
0
votes
2
answers
129
views
Auto Insert row and insert Total and sum using Excel VBA
I want to insert total in the rows based on the Serial Number in Row A starting from Row 6. There are more than 5000 rows in a sheet.
When there are two serial numbers like in this example A15 and A16,...
0
votes
1
answer
91
views
Unable to Change Comma to a Dot in Decimals in R [closed]
I have a .csv file that I’m having trouble processing because the numbers use commas for decimals, which causes issues when reading the file in R. Excel interprets commas for decimals, while R uses ...
3
votes
3
answers
80
views
Sum row values when first column data is equal
How to sum data in 2nd column for same values in column 1:
c = [11 1;
11 3;
12 5;
13 9;
13 11;
13 3]
expected result is:
r = [11 4;
12 5;
13 23]
I know how to ...
0
votes
3
answers
90
views
Need to have excel average every nth row only with data in it
I have a weekly scorecard that our leadership is going to fill out. Its all on one tab and has 500+ rows of the same scorecard that runs with the same statistics. I took a screen grab of one section. ...
-2
votes
4
answers
198
views
How to iterate multidimensional array data and sum some values to return a grouped array
What's the simplest way and uses less computing power to check if a multidimensional array has some equal values in the sub keys and, if is in this way, make the sum of that?
Look at the input. It's ...
0
votes
3
answers
2k
views
SUM on google sheet always returns 0
The sum on my spreadsheet column Category always returns 0.
I have formatted column Amount as Number but still it doesn't work. I had also removed all currency symbols from that column using find &...
3
votes
8
answers
328
views
Cumulatively sum values in a column based upon a Y/N indicator
I am trying to get my head around an MS excel formula for a scenario I have:
I am recording volume sampled and I would like a second column (B) that cumulatively sums the values in A until a Y/N ...
0
votes
1
answer
84
views
Excel return sum of variable date in row where criteria is met
I need to find a date in a row 3:3, and then add all the amounts in that column where in a different column A:A the text is = to a specific criteria
Criteria
1/1
1/2
1/3
Bob
1
4
2
Sue
3
1
3
Jill
1
1
1
...
0
votes
2
answers
301
views
Sum column A based on condition with color on other column
Let's have table like this:
I would like to put the SUM of D5-D7 in cell H10 IF their corresponding cell in column H is colored. I would do the same for all the rest of the dates.
The result shall be ...
1
vote
0
answers
23
views
How to auto sum the calculated field
I have below pivot table and calculated field column in Excel. Not able to get the grand total for calculated column. It is simply subtracting the value 1 from 'num' column as per calculated field ...