r/learnexcel • • Nov 17 '21

help with cells bind while sorting

Hi all, I'm quite new to Excel and making a table that can be sort and a total column kinda like this

A 1 Total
B 2 =sum(B1,B2)
C 3

so I only need the sum of A and B in this case but when for example I sort from Z to A

C 3 Total
B 2 =sum(B1,B2)
A 1

Now the formula of total still B1 and B2 and the Value will be 5 instead of 3. Is there anyway that I can bind the formula of Total to the specific value of A and B so that when sorting it's not going to change?

2 Upvotes

3 comments sorted by

2

u/ManOnACouchMan Nov 18 '21

Is this how your cells are labelled or is this just an example? You could look into using vlookup. =VLOOKUP(A1:B3,”A”,2)+VLOOKUP(A1:B3,”B”,2). My exact recollection may not be perfect but see what you can do. If you are in office 356 use XLOOKUP instead.

1

u/kimurasen Nov 19 '21

Hi, thank you, the table is just an example. The real one is kinda like this

NameClassGradeTotal 1Total 2Total 3Total 4Total 5Total 6
BillA2=2+6+...(all the A)=3+4+2+...(all the B)=C+C+C+C+...=D+D+D+D+...=E+E+E+....=F+F+F+.....
AnnA6
JoeB3
SamB4
KenB2
........
BobF5

So if there is something I can do that make it shorter than a bunch of Vlookup it will be great. What I need is when I sort first column from A-Z and class is mixed up it won't affect the calculation of Total 1, Total 2, .....

1

u/kimurasen Nov 19 '21 edited Nov 19 '21

Thank you, I just figured out you can use sumif for this, thank you