+ Reply to Thread
Results 1 to 9 of 9

Looking for a simpler formula instead of using may nested "IF"s

  1. #1
    Registered User
    Join Date
    12-17-2009
    Location
    Baghdad, Iraq
    MS-Off Ver
    Excel 2003
    Posts
    13

    Question Looking for a simpler formula instead of using may nested "IF"s

    I'm new to the forum but have tried to do alot of reading and testing on my own and I've gotten as far as I think I can go. Basically I receive a bunch of daily reports and I have a master sheet that I use to gather pertinent data. So on my master sheet I use the "MAX" command to find the highest temp from those sheets. I then use a bunch of nested "IF" commands to display the day that the max temp was recorded on. Is there a simpler formula or command to do this?

    I have no prior programming experience or any experience with VBA (if that is even an option or needed). I've gotten this far through brute logic and just don't know enough about the many other commands to try anything else. The current "IF" formula is working just fine, I'm just hoping there's a simpler way to do it. I've attached an example file of what I am doing. I've also added the code that I'm trying to simplify. Thanks in advance.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Looking for a simpler formula instead of using may nested "IF"s

    Welcome to the Board.

    My suggestion:

    Please Login or Register  to view this content.
    Group Day1:Day8 sheets and add the following:

    Please Login or Register  to view this content.
    Now Ungroup the sheets and you can replace your IF with:

    Please Login or Register  to view this content.
    the above assumes that you have only one MAX however... if you have multiple the above will return the lowest day value

  3. #3
    Forum Contributor Lotus123's Avatar
    Join Date
    11-07-2005
    Location
    Texas
    MS-Off Ver
    2007
    Posts
    153

    Re: Looking for a simpler formula instead of using may nested "IF"s

    I suggest this formula for cell A2 (same as suggested before):

    Please Login or Register  to view this content.
    Not sure if this meets the definition of "simpler", but I suggest this for cell B2:

    Please Login or Register  to view this content.
    The only problem with this function is the need to add in all of the days to the indirect function.
    Ecce Potestas Casei
    Nathan Head

  4. #4
    Registered User
    Join Date
    12-17-2009
    Location
    Baghdad, Iraq
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Looking for a simpler formula instead of using may nested "IF"s

    Quote Originally Posted by DonkeyOte View Post
    Welcome to the Board.

    My suggestion:

    Please Login or Register  to view this content.
    Group Day1:Day8 sheets and add the following:

    Please Login or Register  to view this content.
    Now Ungroup the sheets and you can replace your IF with:

    Please Login or Register  to view this content.
    the above assumes that you have only one MAX however... if you have multiple the above will return the lowest day value
    Works great on my test sheet. I will try this out on the actual file itself. I wish I could get onto this site at work. Will this formula work if the data is not a number? I basically pull the max and min values from the sheet. Then I want to know the time and date of the max and min value. The time is no big deal as it's usually treated like a 4 digit number. But the date is usually ddmmmyy format. Thanks for all the help.

    Just another question. I have some other things with the same spreadsheet but aren't related to the topic title. Should I pose the questions here or start up a separate thread for each question? Again thanks for all the assistance.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Looking for a simpler formula instead of using may nested "IF"s

    Quote Originally Posted by Ogbuehi
    Will this formula work if the data is not a number? I basically pull the max and min values from the sheet. Then I want to know the time and date of the max and min value. The time is no big deal as it's usually treated like a 4 digit number. But the date is usually ddmmmyy format.
    In XL dates are Integers and Time is Decimal
    (assuming they're entered as genuine date & time values of course!)

    For ex. on 1900 Date System 6am on 19th Dec 2009 equates to: 40166.25

    dateserial being 40166 and time being .25 (6 am = 1/4 of a day)

    On that basis you should not have a problem.

    Quote Originally Posted by Ogbuehi
    I have some other things with the same spreadsheet but aren't related to the topic title. Should I pose the questions here or start up a separate thread for each question?
    Threads should specific to a given question... so new thread(s) please.

    On a final note - Lotus123's approach is realistically the only non-VBA alternative you have if you prefer to avoid use of "helpers" on the source sheets however as he/she concedes themselves the use of INDIRECT makes the approach volatile and the use of SUMPRODUCT makes it relatively "expensive"... I'd normally say, based primarily on the knowledge of others more knowledgeable than myself, if you can use helpers you should do as though less elegant it will be more efficient long term.

    (also FWIW should there be multiple instances of the MAX the SUMPRODUCT in it's present form would aggregate the respective B2 values which might be prove to be an issue for you - not clear at this point).

  6. #6
    Registered User
    Join Date
    12-17-2009
    Location
    Baghdad, Iraq
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Looking for a simpler formula instead of using may nested "IF"s

    Well how about straight text instead of something number based. The time issue seems to be throwing me off as the time is inputted one way, and the formula no longer recognizes the numbers and displays a 0.

  7. #7
    Registered User
    Join Date
    12-17-2009
    Location
    Baghdad, Iraq
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Looking for a simpler formula instead of using may nested "IF"s

    And one more problem. Basically I copy a week's worth of sheets into the workbook. When I start a new report and paste a new worksheet over the old one, will the formulas stay there? Or is there a way to lock the formulas into that part of the sheet so I don't have to reinput them every single time?

  8. #8
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Looking for a simpler formula instead of using may nested "IF"s

    I understand you are getting daily reports and have a master sheet, but is there some reason why you cannot consolidate all of these daily reports into a single data sheet (using an additional column, if necessary, to ID the data source)? All of your data, at least as suggested by your sample workbook, is of the same type and could be stored in a single sheet.

    It would make your task much easier and provide much more flexibility and simplicity in extracting data, etc.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  9. #9
    Registered User
    Join Date
    12-17-2009
    Location
    Baghdad, Iraq
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Looking for a simpler formula instead of using may nested "IF"s

    The sample test sheet I provided in this forum was just o get the formula part down and simplicity's sake. The actual reports I'm getting contain alot more information than just temp, time, date (multiple generators, status, fuel usage, power factors etc.). If I put them all in one sheet, that sheet for the week would be so huge it would be very difficult to try and navigate. Trust me, if I could just combine that date into one sheet, it would make life alot easier for me. Thanks for the suggestion.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1