Solved

OFFSET - What replaces it

Posted on 2011-09-13
8
381 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
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 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
 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

809 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