I have week days in Column A and values in Column B
I want to look up the column B values that correspond to all the "Thursdays" in Column A and return the lowest of those values.
My apologies if this is a daft question. It's literally been years since I've worked with Excel formulas and I'm rusty.
Many thanks.
You could use MIN formula like
=MIN(IF(A:A="Thursday",B:B))
please note that this is an array formula and you will have to declare it by
Ctrl+Shift+Enter
So once you typed the formula do Ctrl+Shift+Enter
Related
I have got an Excel spreadsheet. This spreadsheet has just one tab in it. The Tab name is dynamic in nature and changes every week also the number of rows.
I have column A filtered already with a VBA macro. A1 has the header.
Now, I wanna find how many rows are there in this already filtered column A.
I am looking for any VBA function.
I have tried using Subtotal function.
=Subtotal(103,A2:A1345)
But I don't know the end range. As of now the end range is A1345. It will change every time in future if the new rows are added.
I tried multiple things but those did not work. I am quite new to VBA.
If A1 will never be blank, you could use (in a column other than A)
=Subtotal(103,A:A)-1.
Or, if there will be data below your table not to be counted, then format your table as a Table and use structured references (and this formula could go into column A)
=SUBTOTAL(103,Table1[column_header])
You can put the formula in column A if you use another column's last populated cell as the demarcation point.
If column B contains numbers then,
=subtotal(103, a2:index(a:a, match(1e99, b:b)))
If column B contains text then,
=subtotal(103, a2:index(a:a, match("zzz", b:b)))
This question already has answers here:
Vlookup using 2 columns to reference another
(2 answers)
Closed 5 years ago.
I need to match Column A and Column B values in Sheet 1 with Column A and Column B values in Sheet 2. If both are same then Copy C values from Sheet 2, and paste in Sheet 1 in C. I will enter values manually in sheet 2 Column C.Here each country will have 2 or more Number. So, both Column A and Column B must match.
I used the formula below. But not working. Most of the Column A and B values are not in order. Help me
=INDEX(Sheet2!$C:$C; MATCH(Sheet1!$A2:B2; Sheet2!$A:$B; 0);COLUMNS($A:B))
You can use the following formula to return what you're looking for. It is an array formula so will need to be entered with Ctrl+Shift+Enter
=INDEX(Sheet2!$C$2:$C$22; MATCH(1; (Sheet2!$A$2:$A$22=Sheet1!$A2)*(Sheet2!$B$2:$B$22=Sheet1!$B2);0))
As it is an array formula I recommend defining your ranges from beginning to end instead of just selecting the whole column. Non-array formulas Excel actively finds the beginning and end of the range and only calculates that subset; however, with array formulas it considers the whole range (even if there's nothing in it) so it can suddenly take a very long time even when there isn't much being calculated
Use the following as a matrix formula:
=INDEX(Sheet2!$C:$C; MATCH(Sheet1!$A2&$B2; Sheet2!$A&$B; 0))
Paste this into cell C2:
=INDEX(C2:C22,MATCH(G2&H2,A2:A22&B2:B22,0))
and use Ctrl+Shift+Enter instead of Enter since it's an array formula.
Then copy that cell as many rows down as needed.
Here are some more examples.
Given
O 1 2 3 A
A 4 5 6 B
B 7 8 9 D
O 3
C 15
T 18
I'm looking for VBA code to validate that when column A contains a value that the remaining columns also contain values and when it doesn't contain a value, that columns 2 & 5 also contain values but 3 & 4 don't.
I've simplified the example, in a real sheet there will be many more columns and rows to check.
I've considered COUNTIF and INDEX/MATCH and array forumlas but from my understanding these all work on single columns at a time.
I want to do something like WHEN A1:An<>"" THEN COUNTBLANK(B:E) ELSE COUNTA (C:D)
Is the best way to use autofilter using blanks in A and then countblank and then a second autofilter for values in A.
Thanks
You can do it with a couple of nested IF formulae as follows:
=IF(A1<>"",
"A not empty, "&IF(COUNTBLANK(B1:E1)=0,
"B:E not blank",
"B:E have blanks"),
"A blank, "&IF(AND(COUNTBLANK(B1)+COUNTBLANK(E1)=0,
COUNTBLANK(C1)+COUNTBLANK(D1)=2),
"Columns 2&5 have values and Columns 3&4 don't",
"but condition not met"))
The reason for going down the VBA route is that I want a generic reusable function as opposed to a formula I copy between cells and sheets changing the columns etc along the way ending up with a lot of duplicate code.
So something that takes a column to test and a value to test it with. Third parameter would be a range of columns to validate, and the fourth parameter the validation.
I don't want any solution to have the columns hard coded and I don't want intermediate totals at the end of rows. This is fairly easily achieved in Excel itself...
The reason for trying to use countblank is that I can apply it to a range.
After a lot of searching I discovered this (the columns don't match the original example)
=SUMPRODUCT((A2:A19<>"")*(B2:D19=""))
=SUMPRODUCT((A2:A19="")*(D2:D19=""))
=SUMPRODUCT((A2:A19="")*(B2:C19<>""))
Nice huh? I just need to convert it into VBA now.
Thanks
If there is already an answer please redirect me.
I want to get statistics from measurements of my drill holes.
Column A holds the drill hole names, Column B holds the measurements. For every entry of a name in column A I want to return the equivalent range in column B. Then feed that range to the median, min and max functions.
Essentially a vlookup that returns a range instead of just a value.
Thank you.
If the values in column A are sorted ascending, you can get the range with an Index function.
INDEX(B:B,MATCH(E2,A:A,0)):INDEX(B:B,MATCH(E2,A:A,1))
Fed that to the Min() function like this.
=MIN(INDEX(B:B,MATCH(E2,A:A,0)):INDEX(B:B,MATCH(E2,A:A,1)))
See screenshot for the setup. The formula is in cell E3.
I have two colums. Column A and Column B which have email addresses. Column A has about 3000 rows, Column B has about 1800. Is there anyway to compare the two columns, and find any fields that match...
And if so, how to either highlight or flag them as a match... or shit, for even simplicitys sake, just give me a count of how many matches were found...
Should i try a macro? Or is there a forumula that will help with this?
You could fill the C Column with variations on the following formula:
=IF(ISERROR(MATCH(A1,$B:$B,0)),"",A1)
Then C would only contain values that were in A and C.
=VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) will solve this issue.
This will search for a value in the first column to the left and return the value in the same row from a specific column.
VLOOKUP deosnt work for String literals