Take a look at the screenshot:
I am trying to count in column B the number of checked boxes (with TRUE value) in columns ABSENT and the same thing in column C for LATE.
Is there any simple way I can do it?
Thank you,
Pawel
You can use the COUNTIFS function for this. Put the following formulas in the indicated cells:
B4
=COUNTIFS(D$2:ZZ$2, "ABSENT", D4:ZZ4, TRUE)
C4
=COUNTIFS(D$2:ZZ$2, "LATE", D4:ZZ4, TRUE)
You can copy these cells down the B and C column to apply the same formula there.
This is what happens in B4:
The columns D to ZZ are scanned for the combination of the following two conditions:
row $2 has the value "ABSENT"
row 4 (the same row as where the formula is) has the value true
The columns are counted where both of these conditions are true.
Related
Could you please help me for below formula little bit complicated
Problem is
In a sheet I have three column A,B,C any one column amount if it is same in D column need to highlight and show which column A or B orC..
Example
A B C D amount in each row
4 5 7 4 please highlight bez a and d match
Next example
5 3 6 2 should not highlight show error msg
In above case D is matching same number with AorBorC
Please help me this logic formula
Formula
=If(countif(A1:d4)=1, "duplicate","unique")
working fine but is there any possibility to show which cell column A or B or C ... If duplicate which column need to mention
Much appreciated for this complicated formula am not sure whether it required VBA here
Your question mentions "Highlight", so here's that part of the solution. Select your first 3 columns of data (A1:C6 in my case). Then go to Conditional Formatting in the Home Tab. Create New Rule, using a Formula to determine which cells to format.
Here's the formula:
=A1=$D1
Change the format fill to your color of choice. Click OK.
EDIT - Adding the last piece here...
Lastly, to display which column(s) match column D value, you could use a formula such as this.
Cell E1 Formula:
=CONCAT(IF(A1=D1,"A",""),IF(B1=D1,"B",""),IF(C1=D1,"C",""))
Drag it down.
XLOOKUP unlike VLOOKUP returns a reference to the cell and not just the value of the cell.
With this in mind =XLOOKUP(D2,A2:C2,A2:C2,NA()) will return the value if it exists as well as the reference.
If we wrap the Return Array with the Column function it will return the column number.
=XLOOKUP(D2,A2:C2,COLUMN(A2:C2),NA())
Add the ADDRESS function to return the cell address (this will return the address on row 1)
=XLOOKUP(D2,A2:C2,ADDRESS(1,COLUMN(A2:C2),4),NA())
Now substitute the 1 in the cell address with a blank:
=SUBSTITUTE(XLOOKUP(D2,A2:C2,ADDRESS(1,COLUMN(A2:C2),4),NA()),"1","")
I need to compare the date of a cell against a column that has multiple date and I see which one it matches and get the associated value. Here I put an image to explain myself better:
Column D is where I need to put the formula, which compares the dates in column A on sheet 1 with the dates in column A on sheet 2. If it matches, I need to multiply the values in column C on sheet 1 by the values in column B of sheet 2.
Here another image with an example to be clearer
I have a little idea that would be something like:
= YES (ERROR (MATCH (Sheet1! A4; Sheet2! A2: A32; 0)); Sheet1! C4 * X
In the x it should go B3, but I don't know how to get that cell in the search above.
Try this:
=VLOOKUP(A3,sheet2!A:B,2)*C3
I have recreated your spreadsheets below.
I am trying to check whether the value in each cell within Column A is in Column D. Some cells in Column D have multiple values within a single cell. If the value of Column A IS found in Column D then I want the formula to return what's in Column B (value next to Column A that matched).
Try:
Formula in C2:
=IF(SUMPRODUCT(--(ISNUMBER(SEARCH(A2,$D$2:$D$5))))>0,B2,"")
Drag down..
If you are looking at just row by row analysis then try this:
=if(iserror(search(a2,d2)),"",b2)
if you are trying to match any row in D then I suggest breaking out all items in D into an item per row and then doing a VLOOKUP
Can you copy column B to Column E? If so,
=Vlookup("" & A1 & "", D:E, 2,0) and scroll down.
If not, a similar index(match( function will work with a wild card. (*)
I have 10000 rows of data in excel in column A & B and a new sheet with all data from column A. What i want to do a VLOOKUP from sheet 1 to sheet 2. But there are few examples in column A with 2 values in B.
Example:
Sheet 1
In sheet 2 if VLOOKUP is done for orange I am expecting 20,30
I have tried single criteria =VLOOKUP(A2,sheet2!a1,false) which worked for apple
Any suggestions how both the expected results can be done together
Not sure if it helps, but here's a solution with the formula:
Array formula in cell E2 (Ctrl+Shift+Enter):
=SUMPRODUCT(LARGE((--(IF(LEN($A$2:$A$6),$A$2:$A$6,OFFSET($A$2:$A$6,-1,0))=$D2))*($B$2:$B$6),1))
In column F you need to replace "1" (at the very end of the formula) with number "2".
A few notes:
your data set cannot start in row 1, otherwise OFFSET formula won't work.
both formulas (columns E & F) are looking for the 1st and 2nd largest number which matches the argument (column D). If the second one doesn't exist, it returns 0.
However, given the size of your data set, it is worth considering a VBA solution.
Edit: adjusted for column B = text
Use the following Array formula in cell E2 (Ctrl+Shift+Enter):
=IFERROR(INDEX($B$2:$B$6,SUMPRODUCT(LARGE((--(IF(LEN($A$2:$A$6),$A$2:$A$6,OFFSET($A$2:$A$6,-1,0))=$D2))*(ROW($B$2:$B$6)),1)-1)),"")
Similar Array formula in cell F2 (Ctrl+Shift+Enter):
=IFERROR(INDEX($B$2:$B$6,SUMPRODUCT(LARGE((--(IF(LEN($A$2:$A$6),$A$2:$A$6,OFFSET($A$2:$A$6,-1,0))=$D2))*(ROW($B$2:$B$6)),2)-1)),"")
Result:
I am trying to search from inside spreadsheet 1 into spreadsheet 2 for 2 things that must be true and if so, pull back another column row.
I want to search column A for the number 12345 and column B for the string "GBP" but I do not know what row 12345 and "GBP" will occur on. If found (there can only ever be 1 result returned so don't worry about multiple results) I need to return the value in column C.
The thing is - I am finding this tricky. Can you help me please?
Create a column C where each cell to the right of data contains the formula
=IF(AND(A2=12345,B2="GBP"),1,0)
When you have copied that formula into each cell down the entire column, search that column for a "1". The "1" is what you are looking for.
As long as there is 1 row matching the criteria, you can use SUMIFS function to get the value from the matching cell:
assuming A2=12345 and B2="GBP" on the current sheet,
sum all values on Sheet 1 column C where both columns A and B match the specified criteria:
=SUMIFS(Sheet1!C:C,
Sheet1!A:A, A2,
Sheet1!B:B, B2)