• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Get a formula where the first and last rows of a lookup range are the value of 2 calculated cells, not manually typed in.|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / Get a formula where the first and last rows of a lookup range are the value of 2 calculated cells, not manually typed in.|General Excel Questions & Answers|Excel Forum|My Online Training Hub

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…Get a formula where the first and l…
sp_PrintTopic sp_TopicIcon
Get a formula where the first and last rows of a lookup range are the value of 2 calculated cells, not manually typed in.
Avatar
Michael O'Flaherty
Wellington

New Member
Members
Level 0
Forum Posts: 2
Member Since:
December 20, 2022
sp_UserOfflineSmall Offline
1
December 22, 2022 - 10:07 am
sp_Permalink sp_Print
  1. In Excel 2019 I have 2 sheets; Category_P&L_CM and Monthly_Sheet.
  2. On sheet Category_P&L_CM column A has account names, column B has amounts for the current month and column C has the year to date amounts.
  3. The list of account names and their data starts at row 10, and the number of the last row varies depending on the activity in the accounts.
  4. The list of accounts is quite long and has a group for Northern Hills in it. This group starts where Northern Hills listed first in column A. Cell E3 has only the words Northern Hills.
  5. Cell F4 has the formula =MATCH(E3,A:A,0) which gives me the row number where Northern Hills first appears, in October this was row 100.
  6. Cell F7 has the formula {=MAX(ROW(A:C)*(A:C<>""))} which gives me the last row number where data appears, in October this was row 127.
  7.  
  8. On Sheet Monthly_Sheet cells P2 and P3 have the the values from F4 and F7 on sheet Category_P&L_CM. 
  9. The first row of my lookups is row 12.
  10. Cell P12 has the following formula: =IF(B12<>"","",IFNA(VLOOKUP($G12,'Category_P&L_ CM'!$A$100:$C$127,2,FALSE),0)).
  11. This formula applies to all cells below P12 in column P.
  12. Next month I will have to change the 100 and 127 to a different row numbers.
  13. How do I get the values of cells P2 and P3 to automatically define my lookup range, so I don't have to manually change the formulae each month?
  14. Thanks Michael
Avatar
MGB
Member
Members
Level 0
Forum Posts: 32
Member Since:
December 13, 2021
sp_UserOfflineSmall Offline
2
December 22, 2022 - 3:36 pm
sp_Permalink sp_Print

May you post sample file

Avatar
Velouria
London or thereabouts
Member
Members


Trusted Members
Level 4
Forum Posts: 574
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
3
December 22, 2022 - 7:20 pm
sp_Permalink sp_Print

You could use:

=IF(B12<>"","",IFNA(VLOOKUP($G12,INDEX('Category_P&L_ CM'!$A:$A,$P$2):INDEX('Category_P&L_ CM'!$C:$C,$P$3),2,FALSE),0))

 

though I would probably define a name using those INDEX functions just to keep the formula more readable and easier to maintain.

Avatar
Michael O'Flaherty
Wellington

New Member
Members
Level 0
Forum Posts: 2
Member Since:
December 20, 2022
sp_UserOfflineSmall Offline
4
January 20, 2023 - 10:24 am
sp_Permalink sp_Print

Hi MGB and Velouria

Thanks for your comments.
I was working on this until just before Christmas, and have just got back on my computer.
I find myself rusty trying to resume where I was at a month ago so have decided to abandon this project.
Nevertheless I am grateful for your interest

Kind regards
Michael

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 170
Currently Online: Mynda Treacy, Riny van Eekelen, Ivan Kulubya, Duaa Elsheikh, Christian Huapaya, Laxmi Praveen
Guest(s) 30
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1431
Anders Sehlstedt: 845
Velouria: 574
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 213
A.Maurizio: 202
Aye Mu: 201
Jessica Stewart: 185
Newest Members:
Vicky Otosnika
Abhishek Singh
Kevin Sojourner
Kara Weiss
And Woox
Armani Quenga
moshood bello
annelies b
James1989
lucy gilmour
Forum Stats:
Groups: 3
Forums: 24
Topics: 6045
Posts: 26524

 

Member Stats:
Guest Posters: 49
Members: 31492
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Riny van Eekelen
© Simple:Press —sp_Information
  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
 
  • About My Online Training Hub
  • Contact
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Copyright © 2023 · My Online Training Hub · All Rights Reserved

Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.

Download A Free Copy of 100 Excel Tips & Tricks

excel tips and tricks ebook

We respect your privacy. We won’t spam you.

x