Display a variety of cells in one cell based on multiple variables

scotchman

New Member
Joined
Nov 10, 2024
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Not sure how to put this but I'll explain what I'm doing. I've created a yearly expenses tracker but in order to have the average of all the months that have gone by I have to edit the variable manually (ex for 3 months gone by =A/3)

I'd like to create a cell for each month gone by and display it in my averages column based on how many months have gone by. So if the March column has an entry in it it displays the average for 3 months. Then once the April column is full it displays the average for 4 months.

I can easily create a bunch of hidden columns but I'm not sure how to pull them to a specific column based on the variables I mentioned. Not even sure if this is possible but I'd love to know how to do it if it is.

Thanks for your help.
 

Attachments

  • excel.jpg
    excel.jpg
    90.4 KB · Views: 2

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Welcome to the MrExcel board!

It is difficult to read your image and in any case we cannot copy from it so there would be a lot of typing to set up a test sheet. I suggest that you make up a small set of dummy data, fill in the results you are asking about manually and post all that with XL2BB
Then explain again in relation to the specific sample data.
(If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.)
 
Upvote 0
Cell Formulas
RangeFormula
L3:L21L3=IF(H3="","",H3)
M3:M21M3=IF(H3="","",H3/2)
N3:N21N3=IF(H3="","",H3/3)
C3:C13,C15:C17C3=IF($B$19="","",B3/$B$19)
E3:E13,E15:E17E3=IF($D$19="","",D3/$D$19)
G3:G13,G15:G17G3=IF($F$19="","",F3/$F$19)
I3:I13,I15:I18I3=IF(H3="","",H3/$H$19)
B19,H19,F19,D19B19=IF(B15="","",B15+B16+B17)
B20,H20B20=IF(B19="","",SUM(B3:B13))
B21,H21B21=IF(B19="","",B19-B20)
D20,F20D20=IF(D15="","",SUM(D3:D13))
D21,F21D21=IF(D15="","",D19-D20)
H3:H17H3=IF(B3="","",B3+D3+F3)
H18H18=IF(B18="","",B18+D18+F18+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!)
J3:J14J3=N3
J15:J21J15=IF(H15="","",H15/12)
J22:J23J22=IF(H22="","",H22/4)
 
Upvote 0
Ugh whoops sorry here. I'm a n00b excuse my mistakes.

00 Yearly Averages - Template test.xls
ABCDEFGHIJKL
1
2ItemJanFebMarTotal%Average1m average2m average3m average
3Housing$500.00$1,000.00$1,500.00$3,000.0025.0%$1,000.00$500.00$750.00$1,000.00
4Phone$50.00$100.00$75.00$225.001.9%$75.00$50.00$75.00$75.00
5Food$500.00$550.00$600.00$1,650.0013.8%$550.00$500.00$525.00$550.00
6Clothing$50.00$75.00$100.00$225.001.9%$75.00$50.00$62.50$75.00
7Health$200.00$300.00$400.00$900.007.5%$300.00$200.00$250.00$300.00
8Entertainment$100.00$200.00$300.00$600.005.0%$200.00$100.00$150.00$200.00
9Gas$250.00$300.00$350.00$900.007.5%$300.00$250.00$275.00$300.00
10Car Costs$550.00$500.00$450.00$1,500.0012.5%$500.00$550.00$525.00$500.00
11Bank Fees/Loans$30.00$25.00$20.00$75.000.6%$25.00$30.00$27.50$25.00
12Tools$50.00$100.00$150.00$300.002.5%$100.00$50.00$75.00$100.00
13Misc$50.00$50.00$50.00$150.001.3%$50.00$50.00$50.00$50.00
14$0.00
15Work Income$3,000.00$3,500.00$4,000.00$10,500.0087.5%$875.00$3,000.00$3,250.00$3,500.00
16Music Income$200.00$300.00$400.00$900.007.5%$75.00$200.00$250.00$300.00
17Govt Income$300.00$100.00$200.00$600.005.0%$50.00$300.00$200.00$200.00
18   
19Total Income$3,500.00$3,900.00$4,600.00$12,000.00$1,000.00$3,500.00$3,700.00$4,000.00
20Total Expenses$2,330.00$3,200.00$3,995.00$9,525.00$793.75$2,330.00$2,765.00$3,175.00
21Surplus$1,170.00$700.00$605.00$2,475.00$206.25$1,170.00$935.00$825.00
22 
Sheet1
Cell Formulas
RangeFormula
E3:E13,E15:E17E3=B3+C3+D3
F3:F13,F15:F18F3=IF(E3="","",E3/$E$19)
I3:I13,I19:I21,I15:I17I3=B3
J3:J13,J19:J21,J15:J17J3=(B3+C3)/2
K3:K13,K19:K21,K15:K17K3=(B3+C3+D3)/3
E18E18=IF(B18="","",B18+C18+D18+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!)
B19:E19B19=IF(B15="","",B15+B16+B17)
B20,E20B20=IF(B19="","",SUM(B3:B13))
C20:D20C20=IF(C15="","",SUM(C3:C13))
B21,E21B21=IF(B19="","",B19-B20)
C21:D21C21=IF(C15="","",C19-C20)
G3:G14G3=K3
G15:G21G15=IF(E15="","",E15/12)
G22G22=IF(E22="","",E22/4)
 
Upvote 0
So basically I want column G to display either column I J or K depending on how much of the table from A:D is filled out. So if Jan and Feb are filled it, it displays the 2 month average, if march is filled in it displays the 3 month average, and so on.
 
Upvote 0
Thanks for getting XL2BB up and running.

I have altered some of the data to demonstrate

I am not sure if you mean this ..

24 11 11.xlsm
GHIJK
2Average1m average2m average3m average
310005007501000
45050
5500500
65050
7300200250300
8150100150
9275250275
Average
Cell Formulas
RangeFormula
J3,J7:J9J3=(B3+C3)/2
K3,K7K3=(B3+C3+D3)/3
I3:I9I3=B3
G3:G9G3=IFNA(LOOKUP(9^9,I3:K3),"")


.. or this

24 11 11.xlsm
BCDEG
2JanFebMarTotalAverage
35001000150030001000
4505050
5500500500
6507512562.5
7200300500250
8100200300600200
Average (2)
Cell Formulas
RangeFormula
E3:E8E3=B3+C3+D3
G3:G8G3=AVERAGE(B3:D3)


.. or something else?
 
Upvote 0
Here I'll post 3 sheets as if it was progressing through the months.

Edit: ignore this reply I made a mistake and didn't find the edit button until after I posted the following post
 
Upvote 0
Whoops I didn't post the first one, let me try again.

00 Yearly Averages - Template test.xls
ABCDEFG
2ItemJanFebMarTotal%Average
3Housing$500.00$500.0014.3%$500.00
4Phone$50.00$50.001.4%$50.00
5Food$500.00$500.0014.3%$500.00
6Clothing$50.00$50.001.4%$50.00
7Health$200.00$200.005.7%$200.00
8Entertainment$100.00$100.002.9%$100.00
9Gas$250.00$250.007.1%$250.00
10Car Costs$550.00$550.0015.7%$550.00
11Bank Fees/Loans$30.00$30.000.9%$30.00
12Tools$50.00$50.001.4%$50.00
13Misc$50.00$50.001.4%$50.00
14
15Work Income$3,000.00$3,000.0085.7%$3,000.00
16Music Income$200.00$200.005.7%$200.00
17Govt Income$300.00$300.008.6%$300.00
18  
19Total Income$3,500.00$3,500.00$3,500.00
20Total Expenses$2,330.00$2,330.00$2,330.00
21Surplus$1,170.00$1,170.00$1,170.00
Sheet1
Cell Formulas
RangeFormula
E3:E13,E15:E17E3=B3+C3+D3
F3:F13,F15:F18F3=IF(E3="","",E3/$E$19)
G3:G13,G19:G21,G15:G17G3=I3
B19,E19B19=IF(B15="","",B15+B16+B17)
B20,E20B20=IF(B19="","",SUM(B3:B13))
B21,E21B21=IF(B19="","",B19-B20)
E18E18=IF(B18="","",B18+C18+D18+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!)


00 Yearly Averages - Template test.xls
ABCDEFG
24ItemJanFebMarTotal%Average
25Housing$500.00$1,000.00$1,500.0042.9%$750.00
26Phone$50.00$100.00$150.004.3%$75.00
27Food$500.00$550.00$1,050.0030.0%$525.00
28Clothing$50.00$75.00$125.003.6%$62.50
29Health$200.00$300.00$500.0014.3%$250.00
30Entertainment$100.00$200.00$300.008.6%$150.00
31Gas$250.00$300.00$550.0015.7%$275.00
32Car Costs$550.00$500.00$1,050.0030.0%$525.00
33Bank Fees/Loans$30.00$25.00$55.001.6%$27.50
34Tools$50.00$100.00$150.004.3%$75.00
35Misc$50.00$50.00$100.002.9%$50.00
36
37Work Income$3,000.00$3,500.00$6,500.00185.7%$3,250.00
38Music Income$200.00$300.00$500.0014.3%$250.00
39Govt Income$300.00$100.00$400.0011.4%$200.00
40  
41Total Income$3,500.00$3,900.00$7,400.00$3,700.00
42Total Expenses$2,330.00$3,200.00$5,530.00$2,765.00
43Surplus$1,170.00$700.00$1,870.00$935.00
Sheet1
Cell Formulas
RangeFormula
E25:E35,E37:E39E25=B25+C25+D25
F25:F35,F37:F40F25=IF(E25="","",E25/$E$19)
G25:G35,G41:G43,G37:G39G25=(B25+C25)/2
B41:C41,E41B41=IF(B37="","",B37+B38+B39)
B42,E42B42=IF(B41="","",SUM(B25:B35))
C42C42=IF(C37="","",SUM(C25:C35))
B43,E43B43=IF(B41="","",B41-B42)
C43C43=IF(C37="","",C41-C42)
E40E40=IF(B40="","",B40+C40+D40+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!)


00 Yearly Averages - Template test.xls
ABCDEFG
45ItemJanFebMarTotal%Average
46Housing$500.00$1,000.00$1,500.00$3,000.0085.7%$1,000.00
47Phone$50.00$100.00$75.00$225.006.4%$75.00
48Food$500.00$550.00$600.00$1,650.0047.1%$550.00
49Clothing$50.00$75.00$100.00$225.006.4%$75.00
50Health$200.00$300.00$400.00$900.0025.7%$300.00
51Entertainment$100.00$200.00$300.00$600.0017.1%$200.00
52Gas$250.00$300.00$350.00$900.0025.7%$300.00
53Car Costs$550.00$500.00$450.00$1,500.0042.9%$500.00
54Bank Fees/Loans$30.00$25.00$20.00$75.002.1%$25.00
55Tools$50.00$100.00$150.00$300.008.6%$100.00
56Misc$50.00$50.00$50.00$150.004.3%$50.00
57$0.00
58Work Income$3,000.00$3,500.00$4,000.00$10,500.00300.0%$3,500.00
59Music Income$200.00$300.00$400.00$900.0025.7%$300.00
60Govt Income$300.00$100.00$200.00$600.0017.1%$200.00
61  
62Total Income$3,500.00$3,900.00$4,600.00$12,000.00$4,000.00
63Total Expenses$2,330.00$3,200.00$3,995.00$9,525.00$3,175.00
64Surplus$1,170.00$700.00$605.00$2,475.00$825.00
Sheet1
Cell Formulas
RangeFormula
E46:E56,E58:E60E46=B46+C46+D46
F46:F56,F58:F61F46=IF(E46="","",E46/$E$19)
G62:G64,G46:G60G46=(B25+C25+D46)/3
E61E61=IF(B61="","",B61+C61+D61+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!+#REF!)
B62:E62B62=IF(B58="","",B58+B59+B60)
B63,E63B63=IF(B62="","",SUM(B46:B56))
C63:D63C63=IF(C58="","",SUM(C46:C56))
B64,E64B64=IF(B62="","",B62-B63)
C64:D64C64=IF(C58="","",C62-C63)


Again, its the averages column I want to update based on which month we're in. I don't want to have to edit the divisor based on which month we're in, I want it to automatically change the divisor.
 
Upvote 0
Again, its the averages column I want to update ..
I'm not sure that you tried the suggestions that I made before, particularly the second one? 😎

Here I have used the same formula all the way down column G. The results are the same as those from your 3 different formulas.
(The AVERAGE function knows to sum the values and divide by the correct number, ignoring empty cells :))

24 11 11.xlsm
ABCDEG
1
2ItemJanFebMarTotalAverage
3Housing$500.00$500.00$500.00
4Phone$50.00$50.00$50.00
5Food$500.00$500.00$500.00
6Clothing$50.00$50.00$50.00
7Health$200.00$200.00$200.00
8Entertainment$100.00$100.00$100.00
9Gas$250.00$250.00$250.00
10Car Costs$550.00$550.00$550.00
11Bank Fees/Loans$30.00$30.00$30.00
12Tools$50.00$50.00$50.00
13Misc$50.00$50.00$50.00
14
15Work Income$3,000.00$3,000.00$3,000.00
16Music Income$200.00$200.00$200.00
17Govt Income$300.00$300.00$300.00
18
19Total Income$3,500.00$3,500.00$3,500.00
20Total Expenses$2,330.00$2,330.00$2,330.00
21Surplus$1,170.00$1,170.00$1,170.00
22
23
24ItemJanFebMarTotalAverage
25Housing$500.00$1,000.00$1,500.00$750.00
26Phone$50.00$100.00$150.00$75.00
27Food$500.00$550.00$1,050.00$525.00
28Clothing$50.00$75.00$125.00$62.50
29Health$200.00$300.00$500.00$250.00
30Entertainment$100.00$200.00$300.00$150.00
31Gas$250.00$300.00$550.00$275.00
32Car Costs$550.00$500.00$1,050.00$525.00
33Bank Fees/Loans$30.00$25.00$55.00$27.50
34Tools$50.00$100.00$150.00$75.00
35Misc$50.00$50.00$100.00$50.00
36
37Work Income$3,000.00$3,500.00$6,500.00$3,250.00
38Music Income$200.00$300.00$500.00$250.00
39Govt Income$300.00$100.00$400.00$200.00
40
41Total Income$3,500.00$3,900.00$7,400.00$3,700.00
42Total Expenses$2,330.00$3,200.00$5,530.00$2,765.00
43Surplus$1,170.00$700.00$1,870.00$935.00
44
45ItemJanFebMarTotalAverage
46Housing$500.00$1,000.00$1,500.00$3,000.00$1,000.00
47Phone$50.00$100.00$75.00$225.00$75.00
48Food$500.00$550.00$600.00$1,650.00$550.00
49Clothing$50.00$75.00$100.00$225.00$75.00
50Health$200.00$300.00$400.00$900.00$300.00
51Entertainment$100.00$200.00$300.00$600.00$200.00
52Gas$250.00$300.00$350.00$900.00$300.00
53Car Costs$550.00$500.00$450.00$1,500.00$500.00
54Bank Fees/Loans$30.00$25.00$20.00$75.00$25.00
55Tools$50.00$100.00$150.00$300.00$100.00
56Misc$50.00$50.00$50.00$150.00$50.00
57
58Work Income$3,000.00$3,500.00$4,000.00$10,500.00$3,500.00
59Music Income$200.00$300.00$400.00$900.00$300.00
60Govt Income$300.00$100.00$200.00$600.00$200.00
61
62Total Income$3,500.00$3,900.00$4,600.00$12,000.00$4,000.00
63Total Expenses$2,330.00$3,200.00$3,995.00$9,525.00$3,175.00
64Surplus$1,170.00$700.00$605.00$2,475.00$825.00
Average (3)
Cell Formulas
RangeFormula
G3:G13,G62:G64,G58:G60,G46:G56,G41:G43,G37:G39,G25:G35,G19:G21,G15:G17G3=AVERAGE(B3:D3)



.. and if you want to use the same formula without having to skip the blank rows, you can use this modification.

24 11 11.xlsm
BCDEH
1
2JanFebMarTotalAverage
3$500.00$500.00$500.00
4$50.00$50.00$50.00
5$500.00$500.00$500.00
6$50.00$50.00$50.00
7$200.00$200.00$200.00
8$100.00$100.00$100.00
9$250.00$250.00$250.00
10$550.00$550.00$550.00
11$30.00$30.00$30.00
12$50.00$50.00$50.00
13$50.00$50.00$50.00
14 
15$3,000.00$3,000.00$3,000.00
16$200.00$200.00$200.00
17$300.00$300.00$300.00
18 
19$3,500.00$3,500.00$3,500.00
20$2,330.00$2,330.00$2,330.00
21$1,170.00$1,170.00$1,170.00
22 
23 
24JanFebMarTotal 
25$500.00$1,000.00$1,500.00$750.00
26$50.00$100.00$150.00$75.00
27$500.00$550.00$1,050.00$525.00
28$50.00$75.00$125.00$62.50
29$200.00$300.00$500.00$250.00
30$100.00$200.00$300.00$150.00
31$250.00$300.00$550.00$275.00
32$550.00$500.00$1,050.00$525.00
33$30.00$25.00$55.00$27.50
34$50.00$100.00$150.00$75.00
35$50.00$50.00$100.00$50.00
36 
37$3,000.00$3,500.00$6,500.00$3,250.00
Average (5)
Cell Formulas
RangeFormula
H3:H37H3=IFERROR(AVERAGE(B3:D3),"")
 
Upvote 0

Forum statistics

Threads
1,223,629
Messages
6,173,437
Members
452,515
Latest member
marinacalus

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