Solved

OFFSET - What replaces it

Posted on 2011-09-13
8
375 Views
Last Modified: 2012-05-12
Hello Excel Experts,

I have a spreadsheet that uses OFFSET.  The OFFSET was used to read a cell that had a formula and now that cell is static so the OFFSET no longer works.  My question is what should I use instead of OFFSET for a static value?  The following is the formula:
=IFERROR(SMALL(OFFSET($M$2,0,0,COUNT($L:$L),1),COLUMN()-COLUMN($M$2)),"")
0
Comment
Question by:CompTech810
  • 4
  • 4
8 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 36529763
OFFSET is actaully giving you a range, not a single cell (unless COUNT($L:$L)=1), so perhaps you just want a static range like M2:M100, i.e.

=IFERROR(SMALL($M$2:$M$100,COLUMN()-COLUMN($M$2)),"")

regards, barry
0
 
LVL 2

Author Comment

by:CompTech810
ID: 36529915
I do need the the count.  The formula counts down a column looking for unique dates and writes them as a heading.
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 36530145
.....but the COUNT function supplies the "height" parameter within the OFFSET function, if you remove OFFSET as requested then COUNT won't be there.

OFFSET defines a range that starts at M8 and is as long as the number of numbers in column L (supplied by COUNT).

Can you explain why the original doesn't work?
0
 
LVL 2

Author Comment

by:CompTech810
ID: 36530422
The original OFFSET works if the value in the cells are a formula to provide a date based on another column.  If the date value is a static date the OFFSET does not show a result.  I did some checking on OFFSET and I read that it uses the VALUE of the cell.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 50

Expert Comment

by:barry houdini
ID: 36530546
OK, let me just give a small explanation of the formula....

=IFERROR(SMALL(OFFSET($M$2,0,0,COUNT($L:$L),1),COLUMN()-COLUMN($M$2)),"")

Let's ignore the IFERROR part, that just returns a blank if the main formula returns an error, so without that we have

=SMALL(OFFSET($M$2,0,0,COUNT($L:$L),1),COLUMN()-COLUMN($M$2))

This is a fairy basic SMALL function of the form

=SMALL(range,n)

where the OFFSET function supplies a range and COLUMN()-COLUMN($M$2) supplies n.

For your formula to work all that you need is for there to be valid numbers in the range supplied by OFFSET (dates are simply formatted numbers).

The formula should work fine whether the range defined by OFFSET is filled with dates that are generated by formulas or manually entered unless they aren't real dates

How are the dates entered/what do they look like? Assuming M2 contains a date what do you get with this formula in a blank cell

=ISNUMBER(M2)

Has column L changed - there need to be numbers in there to help define the range for your OFFSET function.

If the above doesn't help can you possibly attach the workbook or a version of it?

regards, barry
0
 
LVL 2

Author Comment

by:CompTech810
ID: 36531295
I tried the =ISNUMBER(M2) and =ISNUMBER(L2) and both are false.

I have attached the file that is not working (sample1) and the one that is working (sample2).
Sample1.xlsx
Sample2.xlsx
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 125 total points
ID: 36531759
Yes, a FALSE result for ISNUMBER means that it isn't recognised as a date/number.....which messes up the SMALL function which only looks at numbers....

I followed this to convert column L to numeric

Select column L > Data > Text to columns > Next > Next > under "column data format" select "date" and "DMY" option > Finish

I then formatted that column as mm/dd/yyyy - these are now valid dates, so the OFFSET formula should work - I tweaked it slightly to use this version in N1 copied across

=IFERROR(SMALL(OFFSET($M$2,0,0,COUNT($L:$L),1),COLUMNS($M2:M2)),"")

...and I also changed your COUNTIF formula slightly for column M as that was causing a circular reference - in M2 copied down

=IF(COUNTIF(L$2:L2,L2)>1,"",L2)

see attached

Does that do what you need? If you add dates to column L now manually they should be OK as long as you enter a valid date format

regards, barry
27305439.xlsx
0
 
LVL 2

Author Comment

by:CompTech810
ID: 36538049
Hmmm, that's odd.  I selected date format.  Wonder why it doesn't recognize it as a number.

0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now