Can INDIRECT help here?

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Book7
BC
2NameSales
3Tom10
4Tom20
5Tom Total30
6Nick40
7Nick50
8Nick60
9Nick Total150
10Grand Total180
Sheet2


Received a file of which I've extracted a small part of. Problem is everything is hardcoded.
Can I use INDIRECT to help total the values, something like SUM(INDIRECT(B5&"Total")) to pick up the respective subtotals and place the overall total in the Grand Total cell?
Is there a better way to work out totals and quickly make the spreadsheet dynamic so that rows can be added/removed and totals update automatically?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
How about
Book1
ABC
1
2NameSales
3Tom10
4Tom20
5Tom Total30
6Nick40
7Nick50
8Nick60
9Nick Total150
10Grand Total180
Sheet1
Cell Formulas
RangeFormula
C10C10=SUMIF(B3:B9,"*Total*",C3:C9)
 
Upvote 0
Great solution Njimack and Yongle, that is a nice solution.
I wonder can cells C5 and C9 be converted to formulae via SUBSTITUTE or other functions? In other words, change them from hardcoded to actual formulae. I'm sure there's a VBA way of doing this, but is there another way just using Excel's functions?
 
Upvote 0
I do not really ike it, but is seems to work!
Book1
ABC
1
2NameSales
3Tom10
4Tom20
5Tom Total30
6Nick40
7Nick50
8Nick60
9Nick Total150
10Grand Total180
Sheet1
Cell Formulas
RangeFormula
C5, C9C5=SUMIF($B$3:$B$9,SUBSTITUTE(B5," Total",""),$C$3:$C$9)
C10C10=SUMIF(B3:B9,"*Total*",C3:C9)
 
Upvote 0
A better solution would be to delete those hard-coded total rows, and use the built-in Subtotal function.
 
Upvote 0
I do not really ike it, but is seems to work!
Book1
ABC
1
2NameSales
3Tom10
4Tom20
5Tom Total30
6Nick40
7Nick50
8Nick60
9Nick Total150
10Grand Total180
Sheet1
Cell Formulas
RangeFormula
C5, C9C5=SUMIF($B$3:$B$9,SUBSTITUTE(B5," Total",""),$C$3:$C$9)
C10C10=SUMIF(B3:B9,"*Total*",C3:C9)
I don't mind it but you have to know where the totals are. The file I'm working has a number of subtotals so will take a little time to find them all.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,249
Members
449,075
Latest member
staticfluids

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