Excel Formula- Divide a sum into multiple cells? - excel

I need a formula for excel that will allow me to take a sum and divide it up into a number of cells.
for example:
A1= sum
B1 to B4 needs to have a portion of the devided sum
i.e. if sum 1000 then B1=100 B2=200 B3=300 B4=400
Thank's in advance guys
The decomposition rule is that it goes from B1 to B4 in intervals of 100...adding to the pervious

The formula for the lowest term is (2 * s / n - (n - 1) * d) / 2 where
s is the sum
n the number of terms
d the common difference
You have n = 4 and d = 100.
So the lowest term is (s / 2 - 300) / 2.
So if cell A1 contains the sum (1000), you can write =0.5*(A1 / 2 - 300) in cell B1
Then B2 = B1 + 100, B3 = B2 + 100 and B4 = B3 + 100.
The formula comes from the sum of an arithmetic progression.

Try this
Set alias to cell A1 as amount
Use a cell for the number of division which is 4, assume to put in cell A2
Calculate the formula for the total portions to divide, put it in cell A3. In your case A3 =A2*(A2+1)/2
Set alias to cell A3 as total
In each of B columns, set the formula as =(ROW()/total*amount)
Copy the formula from step 5 above until the maximum row in B according to your need

Related

Dragging formulas across - Increment columns by more than 1

I can't seem to find anything similar that's already been asked (they all relate to incrementing row numbers rather than columns)
I'm looking to drag a formula across horizontally and have the columns increment by 2
E.g. B1-A1, D1-C1, F1-E1...
Thanks!
You'll need to have a value in cell A1 and B1 for the following to work.
For my testing I put the number 1 in A1 and B1.
Try this in Cell C1:
=IF(MOD(COUNT($A$1:B1),2)=0,COLUMN(B1),IF(B1<>A1,B1,A1))
Here's what you should see when you drag that formula across:
A B C D E F G H I J K L M N
1 1 2 2 4 4 6 6 8 8 10 10 12 12
And this is what the formula does:
The MOD(COUNT() part of the formula counts the cells to the left of it, and if they are a multiple of 2, the value changes.
I've left the value to change to (the 'new' value) as the COLUMN() number for the cell before, just for example's sake. but you can change this part.
The last IF statement at the end checks if the cell before is equal to the cell before that, (eg. Is CELL C1 equal to CELL B1) and if they are not equal, it will give the cell before as a value (the 'copy' value).

Excel how to find values in 1 column exist in the range of values in another (approximate)

How can I search if values in one cell (column A) exist in column B. With an approximate threshhold of +/- .5
For instance:
Cell A2: 100.26
Column B: 100.30
Is there a formula that can search A2 within all of column B for an approximate match +/- .5 to return true/false?
You can use COUNTIFS() for this:
=COUNTIFS(B:B, "<" & A2 + 0.5,B:B, ">" & A2 - 0.5)
This tests values in Column B twice. Once to see if there is a value less then A2+.5 and then again to see if that value is also greater than A2 - .5
If you want this to return True/False, just turn it into an inequality:
=COUNTIFS(B:B, "<" & A2 + 0.5,B:B, ">" & A2 - 0.5)>0
Update with Example
To show this working, put value 10 in cell A2. Then in B1 though B5 put the following list:
1
4
10.2
20
24
Now in C1 (or any cell on the same tab that isn't A2 or in Column B) put the formula from above:
=COUNTIFS(B:B, "<" & A2 + 0.5,B:B, ">" & A2 - 0.5)>0
And it will spit out "True" because the value 10 that is in cell A2 is within +/-5 from a value that exists in Column B.
Add 2 helper columns C and D where C is =B1-0.5 and fill down and D is =B1+0.5 and filled down.
Then =if(and(a2>C2,a2<D2,TRUE,FALSE)

Determine interval with known total and number of points

Doing some volunteer work for a non-profit, I recently had a problem that I couldn't easily figure out:
I had a dollar total of funds pledged for the year ($150,000), and I knew the total number of pledges (90), and I wanted to see what it would look like if the pledges were distributed evenly from zero to X until the amount had been reached with each increment being the same.
So, for instance if we had $15 raised among 5 pledgers, the even distribution would be 1,2,3,4,5. And I wanted to do it in all in excel, because small non-profit.
Using your provided data setup (Number of backers in cell A1, total pledged amount in cell A2), use this formula in cell C1 and copy down:
=ROW()*$A$2/((1+$A$1)*$A$1/2)
Note that this formula will give you different results than your original. However, it will provide correct results, just as yours does.
This is easy using Solver, we will put the 90 pledges in A1 through A90 and the increment in B1. Lets guess that the increment is 1 so we put that in B1.
in A1 we enter: 1In A2 we enter the formula:
=A1+$B$1
and copy down through A90In A91 we enter:
=SUM(A1:A90)
Clearly this is way off from the desired 150,000We can use Solver to adjust the value in B1 to get the desired result in A91:
The value Solver gets in B1 is 37.4307116107366We naturally would round this to two digits to get a good approximate solution
In a spreadsheet enter as A1 the number of "steps" in my case, pledgers as cell A1. In A2 enter the total you hope to reach. In my example $150,000. Finally in C1 enter the following formula:
= 2 *( ( (-1 * (2 * $A$1 * (ROW()) )) + ( 4 * (ROW()) * $A$2 ) + POWER( $A$1, 2 ) + $A$1 - ( 2 * $A$2 ))/( POWER( 2 * $A$1, 2 ) ) )
And then drag that column down the number of rows equal to your number of steps in A1. If you tally those values, it should equal the value in A2.
You'll notice that I use the ROW() function - if you'd like to start this on row other than row 1, you'll need to adjust the two calls to ROW to subtract the row you're on so that it equals 1 (and wrap it in parantheses) for instance here's the same function started on row 5 - note the "(ROW()-4)":
= 2 *( ( (-1 * (2 * $A$1 * (ROW()-4) )) + ( 4 * (ROW()-4) * $A$2 ) + POWER( $A$1, 2 ) + $A$1 - ( 2 * $A$2 ))/( POWER( 2 * $A$1, 2 ) ) )

Logical calculation in Excel

I need advice/help. I am working on calculation in excel where I have data like mentioned below.
. A B C D E F G H
1| A275 A277 A273 A777 A777 TOTAL A222 GRAND TOTAL
2| 5 7 4 3 4 7 7
Now, I want to count row 2 based on the header.
Here is the condition.
If A1 <> B1 then take A1, if B1 <> C1 then take B1, if C1 <> D1 then C1, so on.
But tricky part is...
If D1<>E1 then D1 else (if E1<>F1 then E1 else (if F1 = "TOTAL" then F1 else(if F1<>G1 then F1)))
In short H2 should have 30 and not 37.
Added comments:------------------------------------
So, Basically if A1<>B1 then take A1 but if A1=B1 then take B1, but then for B1, its a same rule like if B1<>C1 then take B1, but if B1=C1 then take C1 and for C1, same rule. Stopping point will be "TOTAL". Along with these logic I need to check if any cell in row 1 is "TOTAL" then take value for same column. Now this "TOTAL" can be in any cell in row 1.
So from above table my calculation will be 5(A2) + 7(B2) + 4(C2) + 7(F2) + 7(G2) = 30
In this calculation I have not included D2 and E2 as D2=E2 so I took D2, here E2<>F2 so I should have taken E2, but as F2="TOTAL" so I took F2 and not D2 and E2.
I hope this make sense. (Sorry, I know its confusing.)
I have data in more then 100 columns.
Can this be achieved using Macro?
------------------------------------------------------------
Another pain point is data and header are dynamic, so I can't have a fix format. Logic should be in a way that can handle the dynamic data and header.
Any help or suggestion will be greatly appreciated.
I achieved the results you want with this.
Add a helper row. In cell A3 write this formula and drag it to the right:
=IF(OR(A$1=B$1,B$1="TOTAL"),0,1)
Calculate sum in say cell H4 (not H2 because if the formula refers to entire row 2 there will be circular reference):
=SUMIF($3:$3,1,$2:$2)

Excel function for multiple formula

How can I do this equation in excel
If text "t" then goto cell x if not goto cell y
And perform function
I.e
If cell has letter t do (28.5%*cell) if not do (15%*cell)
So the way i understand, You have 3 columns, 1 with a letter, and 2 with numbers. column 1 is either t or something else, and then column 2 and 3 are various answers. So my solution assumes that the letter is column a, and the numbers are columns b and c, and the function goes in d. you can adjust accordingly if the columns are different. then you can drag the function down (or up if you place it in a cell thats on at the top) and it will adjust the row numbers.
=IF(A1 = "t",B1 * 0.285,C1 * 0.15)
so basically it takes cell A1 and checks if it is the letter t. if so, it takes the number in b1` and multiplies it by 28.5% and if not, it takes the number in c1 and multiplies it by 15%.
If text "t" then goto cell x if not goto cell y
Assuming you meant "resolve to" by goto, this could be what you are looking for:
=IF(S1="t",X1,Y1)
When the value of cell S1 is "t", the value of the cell the formula is in, would be the value of cell X1, Y1 otherwise.
If cell has letter t do (28.5%*cell) if not do (15%*cell)
This would be the formula:
=IF(IFERROR(SEARCH("*t*",A1)), 28.5% * B1, 15% * C1)
Some test-data:
A | B | C
1 mytest | 100 | 200
EDIT a ',' was missed there.. I popped that into Excel and it didn't work.
should be =IF(IFERROR(SEARCH("*t*",A1),), 28.5% * B1, 15% * C1)
and that works

Resources