tricky formula

Allainm

New Member
Joined
Nov 13, 2018
Messages
2
I need a formula that will take a number from column A and divide that total starting number into equal values over a variable series of cells in the same row.

Example column A1 = 100, and the formula is copied and pasted across 10 corresponding columns on row 1, the returned value would be 10. If it is only copied to 5 columns the answer would be 20, 4 columns the answer would be 25 etc. The selected columns could start at column B, or column G, or column ZZ. Where it starts doesn't matter so long as the range of cells copied to is a continuous range. (We want to be able to drag the bottom right corner of a cell to draw the range).

The second criteria would allow a manual insertion of a typed in value which the formula would take into account and adjust the other values still containing the formula. In the example of A1 = 100 and the formula is copied over 10 cells, if D1 was to have 19 entered as a value, the other 9 cells would take that into account and execute a result of A1-19=81...81/9 remaining cells should return equal values of 9 in the 9 remaining cells.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Maybe something like this


A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
1
100​
19​
9​
9​
9​
9​
9​
9​
9​
9​
9​

Formula in G1 copied across
=($A1-$D1)/(COUNT(H1:$Z1)+COLUMNS($G1:G1))

Hope this helps

M.
 
Upvote 0
Maybe something like this



A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

1

100​

19​

9​

9

9​

9

9​

9​

9​

9​

9

<tbody>
</tbody>


Formula in G1 copied across
=($A1-$D1)/(COUNT(H1:$Z1)+COLUMNS($G1:G1))

Hope this helps

M.

Hi Marcelo, thank you for the reply. But it doesn't quite satisfy the first criteria. A1=100 is good, but D1=19 is outside of a continuous range of cells (required). For your example to be valid it would have to run F1:O1 or B1:K1. Then 19 entered into any cell in the range would yield 9 in all of the other cells resulting in a sum of the range of cells = to the number in A1 of 100. The sum of the range must always equal the number in A1. Each cell in the range will either be a manual entry or a result of the formula subtracting any/all manual entries within the range from the total in A1 and dividing the remained equally among the cells within the range that still contain the formula.

The range can be across any number of columns from a single column to dozen's of columns.
The ranges can be copied t any number of rows

2nd Criteria would be if the range were shortened to 5 columns, the formula would return a result of 20 in each field, and if any cell in the range were to have a manual entry of 40, the result in the other cells in the range would change to 15.
 
Upvote 0
The cell to be subtracted from A1 must be known (fixed) - otherwise how would Excel (the formula) know which cell to subtract? And such cell should be outside of the range where the formula will be copied (dragged to the right) - otherwise the cell would be overwritten when the formula is dragged..

What you want, as far as i know, is not possible with formulas. Maybe with a macro using the Worksheet_Change event.

M.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top