Split a number in multiples of 60 - excel-formula

I need a formula that would split a number in multiples of 60.
Let's say, If the number in 120(A1), answer should be 60(B1) and 60(C1).
If the number is 150(A1), the answer should be 60(B1),60(C1) and 30(D1).

In B1:
=IF(A1<60,A1,60)
In C2:
=IF(OR(B1<60,B1="",SUM($B1:B1)=$A$1),"",MIN(60,$A$1-SUM($B1:B1)))
And Drag/Copy over enough columns to cover all potential outcomes.

Also try this formula in B1 and copy to C1:?1 as needed:
=IF(COUNT($A1:A1)<=INT($A1/60),60,
IF(COUNT($A1:A1)=1+INT($A1/60),MOD($A1,60),""))

Related

remove number from a column in excel

I am having a column as below in excel. Consider it as a column of elements.
excel_data:
Animal
Dog12ag
Cat13
Choco1234ttt
I need to remove from number in excel.
Desired output:-
Animal
Dog
Cat
Choco
Is there any formula for doing it?
Try:
Formula in B1:
=#TEXTSPLIT(A1,SEQUENCE(10,,0))
Or, in a single go:
Formula in B1:
=TEXTSPLIT(A1:A4,SEQUENCE(10,,0))
Thanks to #Ike.
The following will spill the results:
=BYROW(A1:A4,LAMBDA(b,LEFT(b,MIN(FIND({1,2,3,4,5,6,7,8,9,0},b&"1234567890")-1))))
You may try this as well,
• Formula used in cell B1,
=LET(x,MIN(IFERROR(SEARCH(ROW($1:$10)-1,A1),"")),
IF(x<>0,REPLACE(A1,x,255,""),
A1))
Edit: Using TEXTBEFORE()
=TEXTBEFORE(A1,SEQUENCE(10,,0),,,1,A1)
Or,
=TEXTBEFORE(A1:A4,SEQUENCE(10,,0),,,1,A1:A4)

How to subtract a number from a list?

Subtracting in excel
to subtract 50 from {20,20 ,20} respectively we get {0,0,10}
enter image description here
Try in first cell:
=(SUM($A$11:A11)-$A$10)*(SUM($A$11:A11)>$A$10)
and copy to the right.
The following formula can be used to correctly calculate the amount in cases where the initial number is less than the first value of the array:
=MIN((SUM($A$11:A11)-$A$10)*(SUM($A$11:A11)>$A$10);A11)
Because you need to fix the cell to copy. Refer the cell with 50 as e.g. $A$1 for the cell to be fixed.

Extract number after dash "-" if there is one

Excel Problem.
Let's say I have 2 cells.
A1: HE11294419-12
A2 11296581
I would like to extract the number after the dash found in A1, in another cell.
In case of A2 - the cell should say just "1".
So the result should be
B1: 12
B2: 1
Assumptions:
Always just one dash in string
In case no dash, extract the last number of string
Try in B1:
=IFERROR(MID(A1,SEARCH("-",A1)+1,LEN(A1)),RIGHT(A1,1))
Drag down.
In case the second assumption is wrong, and it always needs to be one just change ..RIGHT(A1,1) to ..1
You can try below formula. It will return first numbers after - if there are multiple - in cell.
=IF(ISERROR(SEARCH("-",A1)),1,TRIM(MID(SUBSTITUTE(A1,"-",REPT(" ",100)),100,100)))

CountIF(s) for out of range criteria

I am trying to work out working formula for CountIF with criteria which is out of the range and I am not sure if "If and Count" would be any differen. Nonetheless, the combination I am trying brings "0" which is certainly not correct.
Can someone please take a look and help?
https://drive.google.com/file/d/0B0aOVjxZjuyrSjdXWG9acWlZMDA/view?usp=sharing
I am trying =COUNTIF(B12:B11511, $A$2=A12:A11511) and have no idea if this will work or not?
Countif(s) for B2 - B8
Thanks a lot.
As you are looking at two cirteria you want to use COUNTIFS:
=COUNTIFS($A$11:$A$11511,A2,$B$11:$B$11511,1)
Put in B2 and copy down. It will count any that match the country and are marked with 1 in column B.
To count the 0, just change the last criterion:
=COUNTIFS($A$11:$A$11511,A2,$B$11:$B$11511,0)
To count both together just sum the two. It can be done two ways:
Add them manually:
=COUNTIFS($A$11:$A$11511,A2,$B$11:$B$11511,1) + COUNTIFS($A$11:$A$11511,A2,$B$11:$B$11511,0)
Use SUM:
=SUM(COUNTIFS($A$11:$A$11511,A2,$B$11:$B$11511,{0,1})
But by your data, which only has 1s and 0s, this formula will return the same numbers.
=COUNTIF($A$11:$A$11511,A2)
Which counts the number of cells in A that match A2.
Use this in B2,
=sum(countifs($A$12:$A$11511, MID($A2, 8, 2), $B$12:$B$11511, {0, 1}))
That counts US with ones and zeroes. Fill down to row 8.

Does Excel round up a number automatically?

The value in cell A2 is 20.64907652 and I have put a formula in B2 which is =A2 but get the value in B2 as 20.65 and I cannot increase the decimals. Is =Round(A2,10) the only way? Thanks.
For number comparisons like this I like to show the explicit "rounding" that you're doing directly in the comprison, like so:
=If(ABS(A1-B2)<.02,"Close Enough","Not Equal")
there are two more formulas :
- =ROUNDUP(A2;2)
- =ROUNDDOWN(A2;2)
I hope this help.

Resources