EXCEL Get the column header of the lowest value in the row - excel

With the help of teylyn's answer in my previous question, the lowest value in the row are successfully highlighted. How to get the column letter to be displayed in the last column?
FROM
TO

=Left(if($C4=Min($C4:$I4),$C$3&" & ","")&if($E4=Min($C4:$I4),$E$3&" & ","")&if($G4=Min($C4:$I4),$G$3&" & ","")&if($I4=Min($C4:$I4),$I$3&" & ",""),LEN(if($C4=Min($C4:$I4),$C$3&" & ","")&if($E4=Min($C4:$I4),$E$3&" & ","")&if($G4=Min($C4:$I4),$G$3&" & ","")&if($I4=Min($C4:$I4),$I$3&" & ",""))-3)
Its ugly...really ugly. But it does work. Put that monstrosity in J4 and copy down.
where to begin with the description, I thought ugly and monstrosity covered it! Basically what the whole formula is doing is checking each number in the row to detemine if it is the minimum in the row. When that condition is true, it returns the value in the header row for that number and tacks on a " & " to it. It then moves on to the next column and performs the same check and adds the results to the previous column. When a number is not the minimum it adds "" to the results which is nothing. After going through all the results and building up a string that will end in "&" we pull the left side of the string, by the length of the string minus 3 characters to remove that last " & ".
Proof of concept

Like said in the comments of Forward Ed's answer, you could shorten the LEN-part with COUNTIF which would look like this:
=LEFT(IF($C4=MIN($C4:$I4),$C$3&" & ","")&IF($E4=MIN($C4:$I4),$E$3&" & ","")&IF($G4=MIN($C4:$I4),$G$3&" & ","")&IF($I4=MIN($C4:$I4),$I$3&" & ",""),COUNTIF($C4:$I4,MIN($C4:$I4))*4-3)
Still I would prefer the MID solution to (partially) skip any check of length like this:
=MID(IF($C4=MIN($C4:$I4)," & "&$C$3,"")&IF($E4=MIN($C4:$I4)," & "&$E$3,"")&IF($G4=MIN($C4:$I4)," & "&$G$3,"")&IF($I4=MIN($C4:$I4)," & "&$I$3,""),4,20)
The way it works should be pretty obvious. However, if there are any questions left, just ask :)

Related

Creating a formula to avoid dragging down without using (=array)

I have three formulas
(1) =(B2:B&"."&substitute(substitute(lower(C2:C),"jalan","jln")," ",""))
(2) =COUNTIF('Payment Configuration'!A:A,A2:A) + COUNTIF('Payment Configuration'!E:E,A2:A)
(3) = =IF(ISBLANK(B:B),,B:B & ", " & UPPER(C:C) & ", BANDAR PUTERI KLANG")
Guys, I want to dragging this formula's until the last row without using Array formula because if I convert this formulas into array somehow it is not working in my web app (which is written in Google App Script). So anyone can help me with this formulas. Thanks in advance
If you want them to only work on a line at a time you need to trim the range to one row only:
=(B2&"."&substitute(substitute(lower(C2),"jalan","jln")," ",""))
=COUNTIF('Payment Configuration'!A:A,A2) + COUNTIF('Payment Configuration'!E:E,A2)
=IF(ISBLANK(B2),,B2 & ", " & UPPER(C2) & ", BANDAR PUTERI KLANG")
With the first two, you could add ISBLANK like your 3rd example.

How to find a specific number in a string of numbers in Excel

I am looking for help with a formula in Excel to find a specific number in a string of numbers.
Our accounting system pulls a report showing numbers from 1 to 10 and each line can have numerous numbers listed in the cell, each separated with a ";".
What I want to do is create a formula that allows me to simply look for the number in columns O to X (row 3) and fill that number in the corresponding cell.
So starting from row 4, I would like to create a formula that finds each number in the string and simply fills in the one I am looking for in each cell, for example I would like the end result to look like the below example:
If the number doesn't appear then that column is left blank, but if it is found it simply adds itself into the corresponding column.
Hopefully someone out there can help me with this.
Regards;
Greg
formula in B3
in German:
=WENN(ISTFEHLER(FINDEN(";" & B$2 & ";"; ";" & $A3 & ";"));"";B$2)
in English:
=IF(ISERROR(FIND(";" & B$2 & ";" , ";" & $A3 & ";")),"",B$2)
Try this in cell O4:
=IF(NOT(ISERROR(SEARCH(O$3,$N4,1))),O$3,"")
Notes:
Assumes your numbers 1 to 10 are in row 3 (i.e O3:X3)

Excel formula - Need value from a range based on the contents of another cell. Part 2

The following formula works great for the most part. I found the solution to my first issue, which was how to return a value based on partial contents of another cell. Check out Scott Craner's solution. Works great! However, when I started entering numbers I get the #NUM! error.
=INDEX(C:C,AGGREGATE(15,6,ROW($C$1:INDEX(C:C,MATCH("zzz",C:C)))/(ISNUMBER(SEARCH(" " & $C$1:INDEX(C:C,MATCH("zzz",C:C)) & " "," " & A1 & " "))),1))
I'm thinking that I'm getting the error because there are "." in the string.
Any help would be appreciated.
The formula you have doesn't work in that case because of what Scott pointed out in his answer:
"The SEARCH will search for matches. The " " & and & " " make sure we are looking for the entire word, So we do not get false positives on things like eric and erica.."
You could remove those spaces from his formula, i.e.
=INDEX(C:C,AGGREGATE(15,6,ROW($C$1:INDEX(C:C,MATCH("zzz",C:C)))/(ISNUMBER(SEARCH($C$1:INDEX(C:C,MATCH("zzz",C:C)),A1))),1))
to make B5 return what you want - which is not a whole "word" but a part of A5, but as a caveat that might allow for false positives. Row 5 is not the same scenario as 1-4. So take this answer with a grain of salt, depending on your data.

Merge data into new cell if other cells match

I have a table in my workbook that pulls information from another sheet. In column A there are names; A1=Tom, A2=Sarah, A3=Steve, etc.. Column B has dates; B1=July26, B2=August08, B3=July26, etc.
There are 10 rows in my table. What I'm trying to do is compress the information down into a single cell C1, and have it as a single line of text. So for this example: "Tom,Steve: July26, Sarah: August08"
Right now I've been building an IF statement to compare, but I was wondering if there was a better way; one that doesn't risk a typo mid way that misses something.
This is what I have (I've started from the bottom (row 10) and building up: =IF(B9<>B10,A9&": "&B9&" "&A10&": "&B10,A9&","&A10&": "&B9)
Any help would be appreciated, thanks
I think that your process of building from the bottom up is the correct way. Otherwise a single formula would be too complicated, and VBA might be necessary.
To build from the bottom up, this is the formula you need at C10. Enter it then copy/paste into C1:C10.
C10:
=A10 & IF(B10=B11, ",", ": " &TEXT(B10, "mmmmdd") & ". ") & C11
p.s. it supposes that your column B contains dates formatted this way. If they are actually text, then replace TEXT(B10, "mmmmdd") with simply B10:
=A10 & IF(B10=B11,",", ": " & B10 & ". ") & C11

Dynamic Vlookup with usage of indirect

I'm having trouble with the usage of Indirect function.
Here's what i'm looking for, I'm trying to create a dynamic vlookup based on the current tab.
=VLOOKUP(B3;'NH BBC'!$E$1:$Z$188;MATCH("Share Outstanding";'NH BBC'!$E$1:$Z$1;0);0)
My plan is to modify the 'NH BBC' by 'NH ' & RIGHT(CELL("filename");3) Supposing that the name of my tab is XXX_BBC.
I've tried to use indirect function but I'm not sure I'm on the good way.
Here's what I've tried:
=VLOOKUP(B3;INDIRECT("'" "NH " & "RIGHT(CELL("'" & "filename" & "'" & ");3)" & "!" & "E1:Z188");MATCH("Share Outstanding";'NH BBC'!$E$1:$Z$1;0);0)
Hope I've been clear.
Thanks in advance !
You are trying to concatenate some text with the results returned from a formula, but you are sticking the formulas in quotes, turning them into text. Furthermore, you are not keeping very good track of your text. There are quotes all over the place. Take this bit by bit in a seperate cell if need, slowly growing your formula from the inside out so you can insure everything is as expected. Right now it's a mess.
INDIRECT("'" "NH " & "RIGHT(CELL("'" & "filename" & "'" & ");3)" & "!" & "E1:Z188")
Should be:
INDIRECT("'NH " & RIGHT(CELL("filename");3) & "'!E1:Z188")
No need for all the complication.
I've finally found and this formula is working perfectly.
VLOOKUP($B3;INDIRECT("'NH "&RIGHT(CELL("filename");3)&"'!$G$1:$ZZ$9999");MATCH("SHARE_OUTSTANDING";INDIRECT("'NH "&RIGHT(CELL("filename");3)&"'!$G$1:$ZZ$1");0))
By the way the issue i've got is that the cell are changing when i'm using the formula in another tab. Is this possible to look the value i've obtained ?
Something like a F9 ?

Resources