Lookup using multiple columns - excel

I have a sheet filled with data below (and in the image):
Now there's this other sheet where the user will only be inputting the column "Gender" and "Age" values and the excel formula should be fetching the associated factor. Please help me with one such formula.
For e.g. If the user puts Male and 23, the formula should return 3. say Male was entered in Cell D46 and 23 was entered in E46 of Sheet named "Sheet4" and the table shown above happens to be in "Sheet1"
Please advise.

Right, now I can visualize what you meant in your other comments in your previous question, it's a rather easy redo of our other formula.
Formula in F3:
=INDEX(C1:C13,MATCH(1,(ROW(C1:C13)>=MATCH(F1,A1:A13,0))*(B1:B13=F2),0))
Entered through CtrlShiftEnter
Notice that these formulas will return a wrong result if, lets say you extend till females age of 29, and you will search for male, it will still return the value for female. It will however not fail when your searchcriteria would be always right.
You could prevent this in this case (because you only really have one criteria and a fixed range with this formula in F3:
=IFERROR(IF(F1="Male",INDEX(C2:C9,MATCH(F2,B2:B9,0)),INDEX(C10:C13,MATCH(F2,B10:B13,0))),"No result")
Just enter normally. What it does is it checks what gender type is chosen and choses it's lookup index accordingly.
Another option would be to use SUMPRODUCT() like so :
=IF(F1="Male",SUMPRODUCT((B2:B9=F2)*(C2:C9)),SUMPRODUCT((B10:B13=F2)*(C10:C13)))
Also, if you are curious what formulas do and want to learn from them, a great way to do so is using the build-in formula evaluate function, that will show you step by step what the formula will calculate.
EDIT
Tried, as per your comment, to break it down for you so you understand what is going on:

For situations like this, I've learned a good trick how to fill in the blank cells:
Select all cells in the column with the "gender" values.
Goto Special, Blanks. (You active cell should be A3)
In the formula bar, type =A2. (I believe that A2 contains the word "Male")
Press Ctrl+ENTER (don't forget the Control key for filling all selected cells)
As a result, A3 will be copied from A2 and contain the word "Male", A4 will be copied from A3 and will now also contain the word "Male", ...
Further: this stops at the first occurence of the word "Female" (this cell is not selected), and for the later cells, the copying happens in the same way as before.
From here, it should be far easier to achieve your goal.

Related

Excel - search for missing values and return these values based on 3 columns - MATCH/INDEX/IF combo?

This gets a bit too expert for me, hopefully one of you can help me!
See the image for what I am trying to achieve. The red text shows what I want. List3 contains all the possible values for List1. List2 displays the currently active values for List1, and I want to return the missing values based on List3.
I'm guessing I'm looking at a MATCH/INDEX/IF function but I cannot figure this one out. Anyone out there willing to give me a hand? <3 Thanks a bunch!
Put this formula in F4 and fill down.
=INDEX(C:C, AGGREGATE(15, 7, ROW(C$2:C$11)/NOT(COUNTIFS(B:B, C$2:C$11, A:A, E4)), COUNTIF(E$4:E4, E4)))
Of course, this formula is dependent on the list of 'numbers' in E4:E7 being accurate and sufficiently populated to catch all missing entries.
Reference the image below. Use this formula to get the number missing:
=SUMPRODUCT(--(A2:A40<>A1:A39))*ROWS(C2:C12)-ROWS(A2:A40)
Change A40 to the last cell of your data in column A and A39 to the second to last cell.
Then enter this helper column as an array formula (Ctrl+Shift+Enter) into a 1-column range with the same number of rows that the formula above returns (it encodes the missing pairs into a single number). I entered it into D4:D8:
=SMALL(IFERROR(0>MATCH(INDEX(A2:A40,INDEX(SMALL(IF(A2:A40<>A1:A39,ROW(A2:A40)-ROW(A1)),ROW(INDIRECT("1:"&SUM(--(A2:A40<>A1:A39))))),INT((ROW(INDIRECT("1:"&ROWS(C2:C12)*SUM(--(A2:A40<>A1:A39))))-1)/ROWS(C2:C12))+1))&INDEX(C2:C12,MOD((ROW(INDIRECT("1:"&ROWS(C2:C12)*SUM(--(A2:A40<>A1:A39))))-1),ROWS(C2:C12))+1),A2:A40&B2:B40,0),INDEX(SMALL(IF(A2:A40<>A1:A39,ROW(A2:A40)-ROW(A1)),ROW(INDIRECT("1:"&SUM(--(A2:A40<>A1:A39))))),INT((ROW(INDIRECT("1:"&ROWS(C2:C12)*SUM(--(A2:A40<>A1:A39))))-1)/ROWS(C2:C12))+1)*ROWS(C2:C12)+MOD((ROW(INDIRECT("1:"&ROWS(C2:C12)*SUM(--(A2:A40<>A1:A39))))-1),ROWS(C2:C12))+1),ROW(INDIRECT("1:"&SUM(--(A2:A40<>A1:A39))*ROWS(C2:C12)-ROWS(A2:A40))))
Again, change A40 to the last cell of your data in column A and A39 to the second to last cell.
Next, enter this formula into E4 and fill down:
=INDEX($A$2:$A$40,INT(D4/ROWS($C$2:$C$12)))
Finally, enter this formula into F4 and fill down:
=INDEX($C$2:$C$12,MOD(D4,ROWS($C$2:$C$12)))

How to report cell value to another cell on excel

I'm entering datas in A column of a table. According to the datas, I making sums from the yellow cell (actually this yellow cell is the high value of the A column). So all 10 cells, there is a sum until the end of datas.
I'm looking for automatically report the seven first grey cells (the sums)to another table. The problem is, according to the datas, high value is not at the same place so the sums are not to the same place too.
How can I do ?
Thank you for your help
MY ERROR :
And the message when I press ctrl maj enter in same time :
You might use this array formula in your report.
=INDEX($F:$F,SMALL(ROW($F$4:$F$117)+(100*(F$4:$F$117="")), ROW(F1)))&""
Bear in mind that, as an array formula, it must be confirmed with Control+Shift+Enter. Enter the formula in the row where you have Somme = 1, then copy down to 6. Note that Row(F1) is a counter. You have a similar counter (1 to 6) in F124:F130. Therefore you can replace ROW(F1) with $F124 (if that is where the "1" is) to make it easier to understand, perhaps.
The formula retrieves the value of the 1st, 2nd, 3rd etc non-blank cell in the range F4:F117. If those cells contain a formula they will be considered "blank" if their result equals "".
BTW, if you don't always have 113 results to evaluate you might consider giving a name to the range E4:E117. For example, if you name that range as "Results" then =SUM(Results) would be the same as =SUM($E$4:$E$117), but as you insert or delete rows within the named range the formula doesn't need to be amended. Use of a named range would simplify understanding your existing formula. You could do the same with column F.
Finally I find a solution to report the values from F to another table. As values positions are dependant of the MAX raw in E (every 10 cells) I make this formula :
For the first : INDEX(E4:F117;EQUIV(GRANDE.VALEUR($E$4:$E$117;1);$E$4:$E$117;0)+10;2)
For the second :
INDEX(E4:F117;EQUIV(GRANDE.VALEUR($E$4:$E$117;1);$E$4:$E$117;0)+20;2)
Etc...

Excel Help - If Cell A1 = "123456", Cell B = "Product Description"

I need help with setting up a formula so that excel produces a product description in one cell if the PO number is entered in the previous cell...
I.e if cell A1 = 123456 then I need Cell be to produce the product description "TELEPHONE" I would need this formula so that I can add additional PO's and products descriptions as we have 100+ items and I don't wish to keep typing the product name when I can hopefully use the PO number in the previous cell?
Store all your product description and its code in say sheet 'Data'.
use the below formula in cell B1 and copy the same on all required cells in B column
=IF(A1="","", VLOOKUP(A1,Data!A:B,2,FALSE)
Most likely you want to use if() function.
And most likely you want to know if in cell A there is number. For that you can use function isnumber().
Example of function:
=if( isnumber(A1), "TELEPHONE", "" )
If you want to check for different descriptions, instead of "", add another if() function.
If you are checking for full match, use vlookup() insted of if().
P.S. To be honest it is hard to understand, your problem.

Multiple If And Statements

I am a novice excel user so I'll explain this the best I can. I need to track Returns, Returns/Exchanges and who processed each...
Cell column A Contains employee Names
Cell column B is where return information will go
Cell column C is where exchange information will go
In B2 I want a formula that will say, if A11:A300 contains 'Ben', and F11:F300 contains 'return', then E11:E300
Does this make sense?
Thanks in advance!
I can't tell if you're attempting to "count" all instances of "Ben" and "return" and collect the total in B2, or if you want to return the value of E11:E300 in B11:B300 when the condition that each row that containing "Ben" and "return" is met.
If it's the former, the this should do it:
=SUM(($A11:$A300="Ben")*($F11:$F300="return"))
Just enter that formula into cell B2 and hold "Ctrl + Shift" while you hit "Enter." That will create an array formula that will count all instances of "Ben" and "return" for each row. You'll know you did it right if the formula is surrounded by curly braces {}. And, no, you cannot manually add them. You must use the entry combination: Ctrl + Shift + Enter.
If it's the latter, then this should do it:
=IF(AND($A11="Ben", $F11="return"),$E11,"")
You could do this more efficiently with an array formula (as specified above), but it's a bit more complicated and I don't want to confuse you since you're an admitted "novice."
Just enter that formula into cell B11 and then drag and copy it down to the remaining 299 rows. This will return the value of E11:E300 in B11:B300 as you requested in your question.
If it's something other than that, then you need to rephrase your question.

match formula when first cell in search range is empty?

is it possible to use an empty cell in a match formula?
I have a value in my cell A3. I want to search this value using 'match' in a matrix A4:A13 (or any other matrix). However, in this case, cell A4 is empty (I cannot help it, it is the way figures are returned from another program).
To be able to search in this matrix I thought I could substitute the value in A3 with {empty}.
substituting works. But then, the Match formula does not work.
The actual formula then would be:
=match("";A4:A13;0)
I cannot change the empty cell in my search range. That one is given. Is there something else I can do to make this work?
edit:
this is the objective of my document:
I have a dashboard sheet on which figures presented.
on this sheet, in column A there are first: account name, brand 1, brand 2, brand 3, brand 4, brand 5 (if applicable,), A.VOGEL, OTHER (result of account total minus the sum of all the brands).
So in this case, cells A3:A10. The figures come from a different sheet. This output is like:
a1 = account name (other cells in this row are empty
a2 = empty, b2 contains a value that cannot be used, c2 shows the brand name (and because in this case, it represents the account total and no brand, c2 is empty) and from D2 : L2, there are values, corresponding to the given value in a1.
a3 = empty, b3 contains a value that cannot be used, c3 has the name of the brand and again, in D3: L3 there are the values.
See my example below:
https://www.dropbox.com/s/jv8wvhtw0aa54dd/output%20sheet%201.png
and the dashboard sheet:
https://www.dropbox.com/s/tgt7omkcytm7xef/DASHBOARD%20sheet%201.png
(and after this account 'nl food-drug' many other account will follow with the same structure).
given this structure, I am trying to create a formula which I can easily paste in every row in the dashboard sheet without being concerned my search matrix will be incorrect.
I thought I was able to do this, but I got stuck.
I would like to have only one formula, which contains everything to have the complete search matrix for both the account total and the individual brands, but which also adjusts and refers to the right account. (so adjusts cell references correctly).
I had 2 different formulas which work: 1 for the account total and 1 for the brands. But I am sure there will be a mistake sometime when I copy paste these rows down the sheet.
My formula always refers to the cell where the account name is in. In the example: A3. To always refer to the right cell I was trying the address, match, indirect formula's together.
one formula which is working now:
=ALS(ISFOUT(INDEX(INDIRECT(ADRES(VERGELIJKEN($A$3;'NIELSEN FD-omzet'!$A:$A;0)+2;4;1;1;"NIELSEN FD-omzet")&":"&ADRES(VERGELIJKEN($A$3;'NIELSEN FD-omzet'!$A:$A;0)+6;12;1;1;);WAAR);VERGELIJKEN($A4;INDIRECT(ADRES(VERGELIJKEN($A$3;'NIELSEN FD-omzet'!$A:$A;0)+2;3;1;1;"NIELSEN FD-OMZET")&":"&ADRES(VERGELIJKEN($A$3;'NIELSEN FD-omzet'!$A:$A;0)+7;3;1;1;));0);VERGELIJKEN(B$2;'NIELSEN FD-omzet'!$D$2:$L$2;0)));"";INDEX(INDIRECT(ADRES(VERGELIJKEN($A$3;'NIELSEN FD-omzet'!$A:$A;0)+2;4;1;1;"NIELSEN FD-omzet")&":"&ADRES(VERGELIJKEN($A$3;'NIELSEN FD-omzet'!$A:$A;0)+6;12;1;1;);WAAR);VERGELIJKEN($A4;INDIRECT(ADRES(VERGELIJKEN($A$3;'NIELSEN FD-omzet'!$A:$A;0)+2;3;1;1;"NIELSEN FD-OMZET")&":"&ADRES(VERGELIJKEN($A$3;'NIELSEN FD-omzet'!$A:$A;0)+7;3;1;1;));0);VERGELIJKEN(B$2;'NIELSEN FD-omzet'!$D$2:$L$2;0)))
nice formula, right? :-)
=MATCH(TRUE,INDEX(ISBLANK(A4:A13),0),0)
Say B1:B4 is the table of values an A1 is the value to find.
This formula:
=IF(A1="",MATCH(TRUE,INDEX(B1:B4="",0),0),MATCH(A1,B1:B5,0))
will work where A1 is empty or not! For example:
and for empty:
EDIT#1
For the Poster's case this would be:
=IF(A3="",MATCH(TRUE,INDEX(A4:A13="",0),0),MATCH(A3,A4:A13,0))
or just:
=MATCH(TRUE,INDEX(A4:A13=A3,0),0)

Resources