Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
I have an Excel question and I'm not sure if I'm approaching it correctly. I have a column of data (C7:C8398) which is all text and I need to return the value given 3 conditions so I wrote the following array. =IF((A7:A8398=P7)*(K7:K8398=Q7)*(M7:M8398=0),C7:C 8398,FALSE) The value is a unique data point (e.g., there is only 1 data point in the entire column that satisfies all 3 conditions). For example, let's say the answer is "test". I don't know how to retrieve the value that I want because the result of the array would be: [FALSE, FALSE, FALSE, ...., "test", FALSE, FALSE...] I tried using INDEX/MATCH functions but I think that requires me to know what the answer is. I don't know the answer is "test". I have a whole column of answers (e.g., C7:C8398) but I don't know the answer that will satisfy the conditions. Any ideas? Am I approaching this incorrectly? Thanks in advance, Stuart |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try also, array-entered (press CTRL+SHIFT+ENTER):
=INDEX(C7:C8398,MATCH(1,(A7:A8398=P7)*(K7:K8398=Q7 )*(M7:M8398=0),0)) -- Max Singapore http://savefile.com/projects/236895 xdemechanik --- " wrote: Hi, I have an Excel question and I'm not sure if I'm approaching it correctly. I have a column of data (C7:C8398) which is all text and I need to return the value given 3 conditions so I wrote the following array. =IF((A7:A8398=P7)*(K7:K8398=Q7)*(M7:M8398=0),C7:C 8398,FALSE) The value is a unique data point (e.g., there is only 1 data point in the entire column that satisfies all 3 conditions). For example, let's say the answer is "test". I don't know how to retrieve the value that I want because the result of the array would be: [FALSE, FALSE, FALSE, ...., "test", FALSE, FALSE...] I tried using INDEX/MATCH functions but I think that requires me to know what the answer is. I don't know the answer is "test". I have a whole column of answers (e.g., C7:C8398) but I don't know the answer that will satisfy the conditions. Any ideas? Am I approaching this incorrectly? Thanks in advance, Stuart |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Public Function GetAnswer() As String
For i = 7 To 8398 If Sheet1.Range("A" & i).Value = Sheet1.Range("P7").Value Then If Sheet1.Range("K" & i).Value = Sheet1.Range("Q7").Value Then If Sheet1.Range("M" & i).Value 0 Then GetAnswer = Sheet1.Range("C" & i).Value Exit For End If End If End If Next i End Function This is how to do that Go to ToolsMacroVisualBasic Editor then Right click on the VBAProject, select INSERTModule then paste the code above in the coding area Back to your excel sheet. Goto to A1 then on the menu click Insert Functions On the insert function dialog, in the category select User define function and in the function list select GetAnswer Hope u understand my instruction. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
thank you all for your help!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Inserting a new line when external data changes | Excel Discussion (Misc queries) | |||
Match Closest Results from Data Array | Excel Discussion (Misc queries) | |||
Help with data not getting plotted | Charts and Charting in Excel | |||
Extending a Chart Data Series from an Array - Can it be done? | Charts and Charting in Excel | |||
VBA Import of text file & Array parsing of that data | Excel Discussion (Misc queries) |