Solved

# Using an IF statement to sort data

Posted on 2015-02-03
60 Views
I am attempting to identify the minimum value occurs before the maximum value, but would like to know if there is a function that I can use, rather than using a macro.

In detail, in row 4, I find the minimum value of 2 and the maximum value of 410.  I would like to return the date (the header row) of the minimum value and the date of the maximum value IF the minimum value occurs before the maximum value.  If the maximum value occurs before, then return nothing.

I have been racking my brain with an IF statement or a combination of IF and range, but am drawing  a blank.  I have a sparkline in place to help visualize how the values fluctuate.
0
Question by:Sabealgo
• 2

LVL 43

Expert Comment

ID: 40587096
Did you intend to upload a file?
0

Author Comment

ID: 40587105
I did. Sorry.  here it is.
SAMPLE.xlsx
0

LVL 47

Accepted Solution

Wayne Taylor (webtubbs) earned 500 total points
ID: 40587311
In row 4, use these formulas...

=IF(MATCH(MIN(C4:V4), C4:V4, 0)<MATCH(MAX(C4:V4), C4:V4, 0), INDEX(C\$2:V\$2, MATCH(MIN(C4:V4), C4:V4, 0)), "")
=IF(MATCH(MIN(C4:V4), C4:V4, 0)<MATCH(MAX(C4:V4), C4:V4, 0), INDEX(C\$2:V\$2, MATCH(MAX(C4:V4), C4:V4, 0)), "")

Note that if the Min or Max values occur twice, only the date for the first occurrence will be returned.
0

Author Closing Comment

ID: 40587330
Thank you for your help.  This works.
0

## Featured Post

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
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…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …