Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

OFFSET - What replaces it

Posted on 2011-09-13
8
Medium Priority
?
391 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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 500 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

721 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