Lookup/SUM formula

James2908

New Member
Joined
Jan 27, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to create a formula (And failing). What I am attempting to do is have a formula look up specific text i.e Spanish and then the week number and then sum up all the numbers across the date range from that week for the Spanish to give a total.

Currently I am just using a sum formula but I have to keep amending this each week.

From the images below the actual column is were I want my total to go and image 2 is the data source.

Please ignore spill error this will be corrected (My excel knowledge is improving slowly but surely!)

Hope this makes sense.

Thanks in advance.

Capture 1.PNG
Capture 2.PNG
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi James2908,

Your "Telephony Data" sheet doesn't actually show what's in column V, the target of your SUM, so I'm going to make a huge assumption. My assumption is that you want to sum the numbers under each Forecast title for the week number specified.

We'll need the week number and it looks like it's part of a string so I've isolated it in D2 of the first sheet.

It is preferred you use XL2BB to post worksheet examples so others don't have to retype your example data. In my case I've just created a small subset of your data but it should extrapolate to your larger data set.

OFFSET is used to return a range of cells. In this example for Spanish and week 21 we want to SUM cells C4 to C7 (assuming the same week numbers are always adjacent). The format of OFFSET is:
OFFSET(starting cell,rows to offset, columns to offset, height in rows, width in columns)
Our starting cell is fixed at $A$2.
The first MATCH looks down column A for the first matching week number, so that's the row offset.
The second MATCH looks for Spanish across cells C2 to U2 and that becomes our column offset.
The COUNTIF counts how many week numbers are 21 so that will be the height of the range.
We are only looking to SUM one column so that parameter is not specified and defaults to 1.

The OFFSET therefore gives OFFSET($A$2,2,2,4) so it returns the range C4:C7 which the SUM then totals.

Here's my Telephony Data

Book3
ABCDEF
1
2Week NumberDateSpanishRussianPolish
320013
4211034
521122
621041
721881
822197
923917
10
Telephony Data


Here's my Sheet1 sample

Book3
ABCDE
1
2Week Number21
3
4SkillsetForecastActual
5Spanish19
6Russian17
7Polish8
8
Sheet1
Cell Formulas
RangeFormula
D5:D7D5=SUM(OFFSET('Telephony Data'!$A$2,MATCH($D$2,'Telephony Data'!$A$3:$A$9999,0),MATCH(B5,'Telephony Data'!$C$2:$U$2,0)+1,COUNTIF('Telephony Data'!$A$3:$A$9999,$D$2)))
 
Upvote 0
Solution
Please ignore spill error this will be corrected
As you are obviously now using 365, you might want to update your profile. ;)

You can use sumifs for what you are trying to do.
 
Upvote 0
Hi James2908,

Your "Telephony Data" sheet doesn't actually show what's in column V, the target of your SUM, so I'm going to make a huge assumption. My assumption is that you want to sum the numbers under each Forecast title for the week number specified.

We'll need the week number and it looks like it's part of a string so I've isolated it in D2 of the first sheet.

It is preferred you use XL2BB to post worksheet examples so others don't have to retype your example data. In my case I've just created a small subset of your data but it should extrapolate to your larger data set.

OFFSET is used to return a range of cells. In this example for Spanish and week 21 we want to SUM cells C4 to C7 (assuming the same week numbers are always adjacent). The format of OFFSET is:
OFFSET(starting cell,rows to offset, columns to offset, height in rows, width in columns)
Our starting cell is fixed at $A$2.
The first MATCH looks down column A for the first matching week number, so that's the row offset.
The second MATCH looks for Spanish across cells C2 to U2 and that becomes our column offset.
The COUNTIF counts how many week numbers are 21 so that will be the height of the range.
We are only looking to SUM one column so that parameter is not specified and defaults to 1.

The OFFSET therefore gives OFFSET($A$2,2,2,4) so it returns the range C4:C7 which the SUM then totals.

Here's my Telephony Data

Book3
ABCDEF
1
2Week NumberDateSpanishRussianPolish
320013
4211034
521122
621041
721881
822197
923917
10
Telephony Data


Here's my Sheet1 sample

Book3
ABCDE
1
2Week Number21
3
4SkillsetForecastActual
5Spanish19
6Russian17
7Polish8
8
Sheet1
Cell Formulas
RangeFormula
D5:D7D5=SUM(OFFSET('Telephony Data'!$A$2,MATCH($D$2,'Telephony Data'!$A$3:$A$9999,0),MATCH(B5,'Telephony Data'!$C$2:$U$2,0)+1,COUNTIF('Telephony Data'!$A$3:$A$9999,$D$2)))
That is absolutely magical thank you

This has worked perfect, Thank you so much for your help!
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,380
Members
448,955
Latest member
BatCoder

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