Sum, iferror, vlookup dilemma

nLeo

New Member
Joined
Feb 25, 2020
Messages
19
Office Version
  1. 2016
Platform
  1. Windows
Howdy,
on sheet with multiple tabs (one for each day) I have names in ColA and values in ColB
each name could be on different rows and the value on the same row as the name..
some days might have the name missing.
I want to get a Week totals so I am using SUM(IFERROR(lookup("bob",'1st'!,$A$3:$A$35,'1st'!,$B$3:$B$35),0) and so on for every day (tab: 2nd, 3rd..)
so if bob is not on day 4th it will just by pass it... \
I do get a result, but when I sum them manually I get a different one..
what am I doing wrong?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
LOOKUP requires that your array be sorted. I think you also have an extra comma in your sheet/cell addresses. You may want to consider an approach like this. Make a record of the Names and Values sheet/cell addresses associated with each day...here names are in column A and values in column B. And then use SUMPRODUCT and INDIRECT to reference those other sheets, pull matching data from them and sum the results across the sheets. In this example, I made three other sheets with three names each...some names appear on both sheets, some names appear on only one sheet.

Book1
ABCD
1Names1st!$A$3:$A$352nd!$A$3:$A$353rd!$A$3:$A$35
2Values1st!$B$3:$B$352nd!$B$3:$B$353rd!$B$3:$B$35
3
4Day 1Day 2 Day 3
5Sue100
6Joe309.5
7Tammy500
8Bob072.5
9Mary0114.5
10Sam0130
Summary
Cell Formulas
RangeFormula
B5:D10B5=SUMPRODUCT((INDIRECT(B$1)=$A5)*INDIRECT(B$2))
 
Upvote 0
thank you Kirk,
each day however, is on a different tab
1585629620343.png
and
1585629645841.png


one or more will be missing and each name could be on different rows on each TAB
 
Upvote 0
Actually no Kirk.. just needed my coffee and reconnect .. and it works thank you.
now I need to put in practice..
 
Upvote 0
and I as I suspected...
what if I want to get an average out of these? (if is not too much to ask)
 
Upvote 0
Just to follow up, yes, the sheet/cell addresses associated with each day make it convenient to see where your information is stored. Then a single formula using SUMPRODUCT & INDIRECT functions pulls matching data from those references. Just be sure to confirm that the worksheet matches with the relevant day. For example, for Day 1, those data are probably on tab "1st", so you'll have "1st!$A$A:$A$35", or something to that effect. Adjust the cell ranges accordingly. There is no harm in opening the ranges up and using the same across all tabs (worksheets).

About the average, what kind of average were you thinking? For example, if Sue has values reported back for Days 1, 2, and 3 of 1, 0, and 14.3...do you want to know the average of 1, 0, 14.3 (a daily average) or the average of 1 and 14.3 (the average per day active, because Sue may not have been assigned that day). I've added some columns that do both.

I may have misunderstood your original post. Did you want to construct a table showing the weekly details broken down by day (which is what this approach does), or did you want a solution that essentially says for Week X, Days 1-5, here are the performance numbers (perhaps sums and averages) without actually showing the daily compilations?
Book1
ABCDEFG
1Names1st!$A$3:$A$352nd!$A$3:$A$353rd!$A$3:$A$35
2Values1st!$B$3:$B$352nd!$B$3:$B$353rd!$B$3:$B$35
3
4Day 1Day 2 Day 3SumAvg/DayAvg/Day Active
5Sue1014.315.35.17.65
6Joe309.512.54.166676.25
7Tammy50051.666675
8Bob072.59.53.166674.75
9Mary0114.515.55.166677.75
10Sam0130134.3333313
Summary
Cell Formulas
RangeFormula
B5:D10B5=SUMPRODUCT((INDIRECT(B$1)=$A5)*INDIRECT(B$2))
E5:E10E5=SUM(B5:D5)
F5:F10F5=AVERAGE(B5:D5)
G5:G10G5=AVERAGEIF(B5:D5,">0")
 
Upvote 0
Thank you, 'your original reply worked perfectly..
basically I have a TAB which represent a week (March 23rd to 29th) and individual TABS for each day.. the weekly TAB is uploaded automatically..
Average will be, for example, the duration of 23,24,25,26,27.28.29 / 7 (days) in this case..
Issue with the Average would be the same as the SUMPRODUCT as Sue will be on A5 on Tab 23rd , might not be on tab 24th and could be on A7 on tab 25th..
 
Upvote 0
That sounds great. If you weren't interested in constructing the table for the week, broken down day by day (which is what the above does), then you could opt for an approach like this:

MrExcel_20200331.xlsx
ABCDE
14SumAvg/DaySheetNames
15Sue15.35.11st
16Joe12.54.1666666672nd
17Tammy51.6666666673rd
18Bob9.53.166666667
19Mary15.55.166666667
20Sam134.333333333
Summary
Cell Formulas
RangeFormula
B15:B20B15=SUMPRODUCT(SUMIFS(INDIRECT("'"&$E$15:$E$17&"'!$B$3:$B$100"),INDIRECT("'"&$E$15:$E$17&"'!$A$3:$A$100"),$A15))
C15:C20C15=B15/3


To apply this to your application, extend the list of sheet names and then adjust the B15 formula to the appropriate range (e.g., E15:E17 might be E1:E7 assuming that's where you put the list for all 7 days). The average then is easy since you want a weekly average regardless of any other condition, so an individual's sum for the week is divided by 7...so the divisor in the formula for cell C15 would be 7 rather than 3 that I show.
 
Upvote 0
THanks Kirk.. going to have a go after a baileys break ;)
 
Upvote 0
Guess I had 1 too many and ended up bad lol.
 
Upvote 0

Forum statistics

Threads
1,215,541
Messages
6,125,413
Members
449,223
Latest member
Narrian

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