+ Reply to Thread
Results 1 to 7 of 7

Search for 2 specific repeating Columns subtract and solve for MAX

  1. #1
    Registered User
    Join Date
    01-28-2015
    Location
    Peoria, Illinois
    MS-Off Ver
    2013
    Posts
    23

    Search for 2 specific repeating Columns subtract and solve for MAX

    I am doing data analysis and need to search numerous columns that contain a "MAX" and "START". My example is populated with 3 repeating columns of data that each have a MAX and START column. I want to be able to find the MAX then subtract the START, hold the value and repeat for the next set of MAX and START(s). Once all the variables are found and subtracted, I just want the MAX value. IE. My max value would be $R2-$T2, which equals 15.

    I can do this all manually, but is not a very efficient use of my time. I'm sure there is a more elegant way to do my task.

    Here is an example of my manual formula: (the below formula does not match my example as to column count)
    -------------------------------------------------------------------------------------------------------------------
    =MAX($FI4-$FK4,$FQ4-$FS4,$FY4-$GA4,$GG4-$GI4,$GO4-$GQ4,$GW4-$GY4,$HE4-$HG4,$HM4-$HO4,$HU4-$HW4,$IC4-$IE4,$IK4-$IM4,$IS4-$IU4)

    The above formula will subtract the 12 pairs and result in the MAX of the 12 variables
    This is my manual way to get the MAX I need. I do not want to look through all the columns and keep recreating the formula manually. My total columns are (DK:BLM), which is quite large.

    Any help is appreciated!

    Thanks You Kindly!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Search for 2 specific repeating Columns subtract and solve for MAX

    Does this work (tested a little)?

    Range (DK:BLM) ??????????

    =MAX(DK4:BLM4-DM4:BLO4)
    Array formula, use Ctrl-Shift-Enter
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Search for 2 specific repeating Columns subtract and solve for MAX

    Quote Originally Posted by Special-K View Post
    Does this work (tested a little)?

    Range (DK:BLM) ??????????

    =MAX(DK4:BLM4-DM4:BLO4)
    Array formula, use Ctrl-Shift-Enter
    I think you'd have to add the criteria using the header ending with (MAX)

    Assuming headers in row 1

    Formula array entered with CTRL + SHIFT + ENTER
    =MAX(IF(RIGHT($FI1:$IS1,5)="(MAX)",$FI4:$IS4-$FK4:$IU4))

  4. #4
    Registered User
    Join Date
    01-28-2015
    Location
    Peoria, Illinois
    MS-Off Ver
    2013
    Posts
    23

    Re: Search for 2 specific repeating Columns subtract and solve for MAX

    Background:
    I have temperature data that is recorded via thermocouples. Eight values are recorded for each specific thermocouple. There are 190 thermocouples repeated as below with varying number sequences.

    Column Headers:
    T_1_1_1_O_04 (MIN), T_1_1_1_O_04 (MAX), T_1_1_1_O_04 (RANGE), T_1_1_1_O_04 (START), T_1_1_1_O_04 (END), T_1_1_1_O_04 (DELTA), T_1_1_1_O_04 (AVG), T_1_1_1_O_04 (STD)

    Here is my array solution:

    {=MAX(IF(LEFT($DL$3:$BKA$3, 3)="T_1", IF(RIGHT($DL$3:$BKA$3, 5)="(MAX)",IF(MID($DL$3:$BKA$3, 5,1)<>"O",$DL4:$BKA4,0),0),0)-IF(LEFT($DL$3:$BKA$3, 3)="T_1", IF(RIGHT($DL$3:$BKA$3, 5)="(MAX)",IF(MID($DL$3:$BKA$3, 5,1)<>"O",OFFSET($DL4:$BKA4,0,2),0),0),0))}

    To break it down:
    I can use the formula along with modifications to seek out a specific thermocouple or pack of thermocouples looking for the MAX temperature rise of searched criteria.
    The above formula finds all thermocouples starting with "T_1", has "(MAX)" at the end, does not contain a "O" as the 5th character from the left, then holds the value. Next it will find the same value again and populate it with the value two columns to the right (My START value) and subtract it from the first value. This gives me the MAX temperature rise. So this solves my initial question.
    Last edited by Vanth_2013; 02-24-2015 at 12:00 PM.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Search for 2 specific repeating Columns subtract and solve for MAX

    You don't need to RE-Find the same criteria a 2nd time, then offset by 2 columns..

    To add the 2 additional criteria (left 3 = T_1, and MID 5 1 <> O) to the formula I posted..
    =MAX(IF(RIGHT($FI1:$IS1,5)="(MAX)",$FI4:$IS4-$FK4:$IU4))
    changes to
    =MAX(IF(RIGHT($FI1:$IS1,5)="(MAX)",IF(LEFT($FI1:$IS1,3)="T_1",IF(MID($FI1:$IS1,5,1)<>"O",$FI4:$IS4-$FK4:$IU4))))

    Now just adjust the ranges to your actual need (it would help if the sample book you posted used the 'actual' range you need it to use)

    =MAX(IF(RIGHT($DL$3:$BKA$3,5)="(MAX)",IF(LEFT($DL$3:$BKA$3,3)="T_1",IF(MID($DL$3:$BKA$3,5,1)<>"O",$DL$4:$BKA$4-$DN4:$BKC4))))

    Still array entered with CTRL + SHIFT + ENTER
    Last edited by Jonmo1; 02-24-2015 at 12:56 PM.

  6. #6
    Registered User
    Join Date
    01-28-2015
    Location
    Peoria, Illinois
    MS-Off Ver
    2013
    Posts
    23

    Re: Search for 2 specific repeating Columns subtract and solve for MAX

    Thanks so much Jonmo1! This makes the statement more elegant and refined. Worked like a charm! It will decrease the processing power and time needed for all of my formulas that scan the 6,500 rows and approx. 1,524 columns. Now to apply this to my MIN and AVERAGE(s).
    Last edited by Vanth_2013; 02-24-2015 at 01:38 PM.

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Search for 2 specific repeating Columns subtract and solve for MAX

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 12-02-2014, 05:17 PM
  2. [SOLVED] .Find Help - Search only in specific columns (or ignore other columns)?
    By NewYears1978 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2014, 11:32 AM
  3. Formula Needed to Solve from one Group of cells then subtract to limit....
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-06-2013, 03:27 PM
  4. VBA to create specific named ranges and repeating process (Loop?) across columns
    By vinothj86 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-30-2012, 05:01 AM
  5. Search for 3 specific columns and copy
    By csynic in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2011, 04:43 PM

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