Check range for current year match and return specific cell value

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,602
Office Version
  1. 365
Platform
  1. Windows
Hi all

Simple formula needed to check year thru C4:L4 and once match found for current year the 'TOTAL' from the same year in row 23 is copied to SHEET1 Cell D3

NDA.xlsm
ABCDEFGHIJKL
2FINANCIAL YEAR
3
4202120222023
5JAN66018,065
6FEB23519,050
7MAR345-
8APR1,010-
9MAY430-
10JUN1,665-
11JUL625-
12AUG1,175-
13SEP1,425-
14OCT140-
15NOV1,800-
16DEC985-
17
18Q11,24037,115--------
19Q23,105---------
20Q33,225---------
21Q42,925---------
22
23TOTAL10,49537,115--------
Financial Year
Cell Formulas
RangeFormula
C5:C16C5=SUMIFS(Data!$F$2:$F$8000,Data!$B$2:$B$8000,B5,Data!$D$2:$D$8000,'Financial Year'!$C$4)
D5:D16D5=SUMIFS(Data!$F$2:$F$8000,Data!$B$2:$B$8000,B5,Data!$D$2:$D$8000,'Financial Year'!$D$4)
C18:L18C18=SUM(C5:C7)
C19:L19C19=SUM(C8:C10)
C20:L20C20=SUM(C11:C13)
C21:L21C21=SUM(C14:C16)
C23:L23C23=SUM(C5:C16)



So in this example 37,115 will be copied to SHEET1 cell D3 as the current year is 2022

Thanks in advance
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try this in Sheet1:D3

Excel Formula:
=HLOOKUP(YEAR(TODAY()),'Financial Year'!C3:L22,20,0)
 
Upvote 0
Try this in Sheet1:D3

Excel Formula:
=HLOOKUP(YEAR(TODAY()),'Financial Year'!C3:L22,20,0)

I'm getting a #REF! error when pasted into Sheet1:D3

Also Shouldn't it be cell C4:L22 and not C3:L22?
 
Upvote 0
It works OK for me:

Book1 (version 1).xlsb
D
337115
Sheet1
Cell Formulas
RangeFormula
D3D3=HLOOKUP(YEAR(TODAY()),'Financial Year'!C3:L22,20,0)


Is 'Financial Year' the name of the sheet? Are there any extra spaces in there? You could edit the formula, delete the 'Financial Year'!C3:L22 part, then select the other sheet, select the range, then hit Enter.
 
Upvote 0
Solution
It works OK for me:

Book1 (version 1).xlsb
D
337115
Sheet1
Cell Formulas
RangeFormula
D3D3=HLOOKUP(YEAR(TODAY()),'Financial Year'!C3:L22,20,0)


Is 'Financial Year' the name of the sheet? Are there any extra spaces in there? You could edit the formula, delete the 'Financial Year'!C3:L22 part, then select the other sheet, select the range, then hit Enter.

Not sure what was going on, but I did as suggested and now its perfect - thanks a lot for your help
 
Upvote 0

Forum statistics

Threads
1,215,470
Messages
6,124,992
Members
449,201
Latest member
Lunzwe73

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