Excel formula to add numbers stored as text - excel

My NodeJS program populates an excel formula in a cell which in turn calculates the sum of all the numbers in a column. The numbers are stored as text in the cells.
The formula used is : =SUM(0+(I5:I19999)).
All the numbers are present in column 'I' but not necessarily till 19999th row (few may be blank).
However, the result of this formula is always #VALUE!.
I can't seem to find the issue in this.
Any help in this issue is really appreciated.
Thanks!

Formula you are using to add numbers stored as text i.e. =SUM(0+(I5:I19999)) is an array formula and needs to be committed by pressing Ctrl+Shift+Enter.
If you want non-array formula you can use
=SUMPRODUCT((I5:I19999)*1)

the value in the cell must be stored as a number because sum works on numbers only if you give text then it will display #VALUE.
you can store value as numbers using numformat('0.00').you can get more info from this page https://support.office.com/en-us/article/Number-format-codes-5026bbd6-04bc-48cd-bf33-80f18b4eae68.if you are reading then you have to convert it.
Could you please let me know which package(exceljs,Node-xlsx) are you using so that i can send you the code require?

Related

Sum of strings in Excel

I'm trying to take the sum of numbers that are formatted as strings in Excel without firstly reformatting them as numbers manually, on row I.
How is this done?
My best attempt so far is
=VALUE(SUM(I:I))
But does not work :(
Any ideas?
One option:
=SUMPRODUCT(IFERROR(--I1:I1000,0))
Depending on your version of Excel, may need confirmed with Ctrl+Shift+Enter.
Adjust the range as necessary.
Note: =SUM(IFERROR(--I1:I1000,0)) is a valid (and shorter!) option.
Maybe this can help. Typed some words and numbers mixed, and formatted all those cells as text.
My formula in C13 is an array formula:
=SUM(IF(ISNUMBER(VALUE(A1:A10))=TRUE;VALUE(A1:A10)))
Because it's an array formula, it must be entered with CTRL+ENTER+SHIFT
IMPORTANT: Sometimes when referencing cells formatted as text in a formula, the active cell gets formatted to text. So make sure the cell contanining the formula (in my image, C13) is formatted as Standard.

Formula to Retrieve Multiple Column Numbers in Which a Value Appears

I am trying to use an on sheet formula that will provide me with all the column numbers in which a value exists. For the sake of example: I want to find all the columns on Sheet1 that have a value of ThisHeader in Row1.
I have been able to use the below formula to retrieve the result I want if the value I'm searching for only appears one time:
=MATCH("ThisHeader",1:1,0)
I'm unsure how to implement this same logic, but give me multiple column numbers if ThisHeader exists in multiple columns.
I'm not particular about how the result is displayed, although ideally I'd use something like: =SUBSTITUTE(ADDRESS(1,col_number,4),"1","") after the column numbers are retrieved in order to translate to a letter format. perhaps with a comma or dash separating each number/column letter. I could add or use multiple formulas and columns rather than a nested formula as well if that is the best or only route.
Thanks in advance!
If you have O365, you can use:
=AGGREGATE(15,6,1/($1:$1="ThisHeader")*COLUMN($1:$1),SEQUENCE(COUNTIF($1:$1,"ThisHeader")))
If you do not have the SEQUENCE function, you can replace it and use:
=AGGREGATE(15,6,1/($1:$1="ThisHeader")*COLUMN($1:$1),ROW(INDEX($A:$A,1):INDEX($A:$A,COUNTIF($1:$1,"ThisHeader"))))
Results
The formula returns an array of the column numbers. So, to visualize them if you don't have the dynamic array feature of recent Excel versions, you may have to enter this as an array formula (with ctrl+shift+enter over multiple cells. Or by using an INDEX function to return each element.

Excel - How to count the number of distinct texts of a specific date inside a table?

I'm trying to count the number of distinct text from a specific date in a data table.
Data Sample with expect result :
I was able to figure out how to count the distinct element from a range I specify, because I can determine the first and last row containing the date.
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
I have tried to modify my formula so that it determines the cell range by itself but without success.
I searched for an answer, using a combination of CELL and MAXIFS, example below, but Excel does not accept the formula.
=CELL("row",MAXIFS(A2:A15,A2:a15,D2))
I've looked at the INDEX formula, but I can't figure out how to do what I want to do. 😑
Any idea what I'm doing wrong, or what I should be doing instead?
Thanks, I appreciate it!
If you have Office 365 and the new Dynamic Arrays, this sort of formula has become ridiculously easy.
This formula in cell E3:
=COUNTA(UNIQUE(FILTER($B$2:$B$15,$A$2:$A$15=D3)))
Copy down.
You can also generate the unique list of dates with this formula in D3, which spills down automatically and does not need to be copied.
=UNIQUE(A2:A15)
It wasn't easy, but by separating each step of the problem, I was able to solve it.
Note that my solution only works because my dates are sorted.
Here's the final formula in the cell "One formula to rule them all":
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2))),INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)))))
Here are my explanations of my process:
Formula if I select the range :
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
Formula to get the first iteration
=ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2)
Formula to get the last iteration
{=ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)}
Create range from two addresses
=INDIRECT(CONCATENATE(F3,":",G3))
Formula giving me the expect result
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(F3,":",G3)),INDIRECT(CONCATENATE(F3,":",G3))))

How to find the first value in a column larger than the previous value in the column

I'm looking for an excel formula to return the index of the first value in a large column such that ABS((COL)(ROW)-(COL)(ROW+2))< 0.1
Clearly, this is pretty easy to program in VBA by starting with the first row in the column and iterating through. However, I'm just looking for an excel formula in this case.
I think it will need to be something functionally like:
=INDEX($A$1:$A$100,MATCH(TRUE,($A$1:$A$100)-($A$3:$A$102)<.1,0))
This clearly won't return anything. I'm interested in how to do that subtraction part using excel formulas.
Thanks!
Just need to add the ABS and ARRAY ENTER the formula:
=INDEX($A$1:$A$100,MATCH(TRUE,ABS(($A$1:$A$100)-($A$3:$A$102))<.1,0))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.

Excel - float number cannot be summed

I have a bunch of values like 0.5, 1.0, 1.5 etc.
I want to write a SUM function for those cells but the value is 0.
If I use integers the summing works so there is something with the nbrs that is wrong. Maybe they are strings?
Because they end up to the left in the cell instead of the right like integers.
What do I need to do?
=SUM(H22:H26)
Fell on the issue today: I exported data that I pasted into Excel. The formula =SUM(B:B) supposed to sum my decimals kept on returning 0...
It's stupid, but it made me lose 5 minutes: the decimal separator . had to be replaced by , or Excel wouldn't understand it as a decimal number.
Of course, it depends on Excel/system regional settings.
In a new column, try multiplying the original column by 1; then sum the new column. Not sure, but that may fix the issue.
Convert the numbers to values first with
=value(H22), =value(H23), etc.
in column G and then do
=SUM(G22:G26)
Alternatively, you can just do
{=SUM(VALUE(H22:H26))}
Notice this is an array formula, so select it and hit F2 and then CTRL-SHIFT-ENTER
Especially if the data came from a web page or HTML document, try the following
This formula must be array-entered:
=SUM(IFERROR(--TRIM(SUBSTITUTE(A1:A100,CHAR(160),"")),0))
To array-enter a formula, after entering
the formula into the cell or formula bar, hold down
< ctrl >< shift > while hitting < enter >. If you did this
correctly, Excel will place braces {...} around the formula.
HTML frequently adds the NBSP character for spacing, and that must be removed specifically before Excel will see the value as a number.
If you want to do this in one cell, basically you should convert values and sum them
=VALUE(SUM(H22:H26))
Tried and verified!

Resources