OFFSET query

steve80s

New Member
Joined
Aug 18, 2022
Messages
12
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have a formula that's working perfectly for me, which is this...

"=IF($C4=0,"",MIN(IF('Main Log'!$D$4:$D$2000=$B4,IF('Main Log'!$O$4:$O$2000,"",'Main Log'!$E$4:$E$2000))))

It finds the minimum value (earliest date) in my 'Main Log' sheet where the criteria are met.

However, in the next column, I want to show the contents of the cell 2 columns to the right of the earliest date as identified by that formula.

In other words, if I use the formula above in D5, it will correctly return the oldest Clinic Date matching the criteria I set up. Now I want D6 to show me the NHS. No for that clinic date (which is located 2 cells to the right of the Clinic Date).

Clinic
Type
Clinic
Date
ClinicianNHS No.
SACC02/08/2022765433
SACC01/01/20221234567
Neuromotor10/08/202212334234

I can't get this to work. Can anyone advise please?

Thanks in advance.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
If you have the Date in D5 then you can use vlookup; ie in D6
Excel Formula:
=VLOOKUP(D5,'Main log'!B1:D20,3,0)
 
Upvote 0
If you have the Date in D5 then you can use vlookup; ie in D6
Excel Formula:
=VLOOKUP(D5,'Main log'!B1:D20,3,0)
Hi,

Thank you for replying.

However, the issue is, there are sometimes multiple clinics on the same date. This is returning the first instance of finding the date on the list. It also needs to take into account the criteria as given in my original D5 formula.

If you look at my original spreadsheet below it will probably make more sense. The actual location I'm trying to find a formula for is the Current Status sheet, L4. My original formula is on Current Status sheet, J4.

You can see both SACC and JACC have clinics on the same date (Main Log). Your formula is just pulling details of Ian and Pluto from the log for both.

Any other ideas please?
 

Attachments

  • Current Status.PNG
    Current Status.PNG
    58.5 KB · Views: 7
  • Main Log.PNG
    Main Log.PNG
    45.5 KB · Views: 6
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: How to use OFFSET when the reference is a formula linked to another tab?
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Don't miss the Administrator message, above...

Please provide a usable sample of data that includes all the columns mentioned in the formula
With the current information I would guess that the second formula should be
Excel Formula:
=IF($C4=0,"",MIN(IF('Main Log'!$D$4:$D$2000=$B4,IF('Main Log'!$O$4:$O$2000,"",'Main Log'!$G$4:$E$2000))))
(two columns after E)

But at this stage my suggestion is:
-use your formula to get the "index" of the target row; the formula should be:
Excel Formula:
=IF($C4=0,"",MIN(IF('Main Log'!$D$4:$D$2000=$B4,IF('Main Log'!$O$4:$O$2000,"",ROW('Main Log'!$E$4:$E$2000)))))

-then use this Index to extract from the table in MainLog the columns that you need using INDEX; for example, if the index is in I4 and you want to get column E of MainLog:
Excel Formula:
=INDEX('Main Log'!$E$1:$E$2000,$I4)

This will save repeating the same tests in the final formulas, that is especially useful if you have to extract several information out of the same row
 
Upvote 0
See the answer I published in the thread (crossposted):

The formula is (replace semicolons with commas if your locale uses commas as function argument separators):
Excel Formula:
=INDEX('Main Log'!$G$1:$G$2000;MIN(IF(('Main Log'!$D$4:$D$2000=$B4)*('Main Log'!$O$4:$O$2000="")*('Main Log'!$E$4:$E$2000=J4);ROW('Main Log'!$D$4:$D$2000);"")))
 
Upvote 0
Solution

Forum statistics

Threads
1,223,703
Messages
6,173,977
Members
452,540
Latest member
haasro02

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