You are here:

Excel/4 kind of values from range


My input range is AC38:BH38 which contains either a value or is empty. There is also a range, $AC$58:$BH$58, which contains a value of "Y" or is also empty.

If a cell within the range $AC$58:$BH$58 contains the value "Y", then the corresponding cell within row 38 is not empty. I want the value within that cell only if its value is greater than 0.

The answers required are (formatted as Answer#_ = ):

Value of the 'Last cell' (Right hand side) of the input range AC38:BH38 meeting the above 2 conditions.
Value of the 1 cell left of the cell that satisfies Answer #1 if it also satisfies the initial conditions.
Value of the 2 cell LEFT to the above cell(Answer #1) provided it also meets the above conditions.
Value of the 3 cell LEFT to the above cell(Answer #1) provided it also meets the above conditions.

I want 4 answers from the entire range of AC38:BH38 in output cells, say, CA38, CB38, CC38 & CD38. The formula should check all the cells of AC38:BH38 to ascertain which cell/(s) qualifies (a cell qualifies if it meets the above 2 conditions) & then give the answers as per the 4 types of requirements. 2 conditions: Value of the cell (in AC38:BH38) MUST BE>0; the corresponding cell in $AC$58:$BH$58 MUST CONTAIN the value "Y". Ex: AC38=777 & AC58=Y QUALIFIES; AD38=999 & AD58="" DOES NOT QUALIFIES


These entered as array formulas (commit with Ctrl+Shift+Enter rather than just enter).

="Answer #1 = "&Index($38:$38,1,LARGE(IF(($AH$58:$BH$58="Y")*(LEN(TRIM($AH$38:$BH$38))>0)*($AH$38:$BH$38>0),COLUMN($AH$58:$BH$58)),1))

="Answer #2 = "&INDEX($38:$38,1,LARGE(IF(($AH$58:$BH$58="Y")*(LEN(TRIM($AH$38:$BH$38))>0)*($AH$38:$BH$38>0),COLUMN($AH$58:$BH$58)),2))

="Answer #3 = "&INDEX($38:$38,1,LARGE(IF(($AH$58:$BH$58="Y")*(LEN(TRIM($AH$38:$BH$38))>0)*($AH$38:$BH$38>0),COLUMN($AH$58:$BH$58)),3))

="Answer #4 = "&=INDEX($38:$38,1,LARGE(IF(($AH$58:$BH$58="Y")*(LEN(TRIM($AH$38:$BH$38))>0)*($AH$38:$BH$38>0),COLUMN($AH$58:$BH$58)),4))

again, these must be entered with Ctrl+Shift+Enter rather than just enter since these are array formulas.

Tom Ogilvy  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Tom Ogilvy


Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]


Extensive experience.

Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2017 All rights reserved.