I have two columns of data, one with dollar amounts and another with a text value. I'm trying to create a formula at the bottom that will add together only the values in A for which the corresponding row in column B equals "Yes". So in the example below my formula would return a sum of 1000:
| A | B |
|500 |Yes |
|150 |No |
|500 |Yes |
|533 |No |
|1000 |
My actual spreadsheet has many more rows, so I want a formula that can compare the entire range in column A against the entire range in column B, row by row. Is this possible to do without having to set up a macro?
Please try:
=SUMIF(B1:B4,"Yes",A1:A4)
Adjust the ranges to suit but ensure they are of equal size.
Related
I'm trying to highlight rows in my spreadsheet where cell values in Column B start with qr.
I tried following ExcelJet's example "Highlight cells that begin with," but this method will ONLY highlight cells. It will also highlight other cells in other columns where cell's value (string) begins with qr.
I did come up with a small googled solution.
Created a rule within Conditional Formatting and used this.
=SEARCH("qr",CONCATENATE($A2, $B2, $C2, $D2,$E2,$F2,$G2))=1
The problem with this solution is it will concatenate the rows in which qr exists and highlight them. It will also do this to rows in which a cell's value other than in column B starts with qr.
May I get some help with this please?
I wasn't able to produce a solution table for my question, but the solution would be the same table with ROW 2 AND ROW 5 highlighted only. The current rule I'm applying will highlight ROW 2,3, and 5 and concatenate their cells.
|---|---------------------|------------------|---------------------|
| | A | B | C |
|---|---------------------|------------------|---------------------|
| 1 | Full Name | Username | Email Address |
|---|---------------------|------------------|---------------------|
| 2 | Mario | qrmrincon | mrodrigez#yahoo.com |
|---|---------------------|------------------|---------------------|
| 3 | Sofia | sgrahama3 | recio1#hotmail.com |
|---|---------------------|------------------|---------------------|
| 4 | Qrig | grecio1 | recio1#msn.com |
|---|---------------------|------------------|---------------------|
| 5 | Mora | qrmturner2 | turner2#aol.com |
|---|---------------------|------------------|---------------------|
For the Conditional Formatting formula, just use:
=LEFT($B2,2)="qr"
Then for the "Applies to" range, put:
=$A$2:$C$100
(Adjust that last row based on the data)
And just format as you wish (a Fill is likely what you want).
I have 3 columns in Excel. The data in first column are complete dates from given year in ascending order. In second column are also dates but in between these dates there can be a missing day. So if i place these dates next to each other they do no line up. And in third column there is some date that corresponds to the date in 2nd column. Now what i would like to do is to align those dates, and where there is no date in first column the row is empty.
I have already put some code together for excel to lign up the data, but i dont know how to align the dates together with the values in third column(C column).
Here is my code:
=IF(ISNA(MATCH(A1;C:C;0));"";INDEX(C:C;MATCH(A1;C:C;0)))
Here is a visualization(the data in column A is all the dates in a given year. The data in column B and C must be moved together):
| A | B | C |
|1.1.2018 |3.1.2018 |12345 |
|2.1.2018 |14.1.2018 |54321 |
|3.1.2018 |2.2.2018 |56789 |
|4.1.2018 |2.1.2018 |11111 |
Desired output:
| A | B | C |
|1.1.2018 | | |
|2.1.2018 |2.1.2018 |11111 |
|3.1.2018 |3.1.2018 |12345 |
|4.1.2018 | | |
Based on your sample data this formula will search column B for the first instance of the date that is in column A and return the value from column C on that row.
In cell D1 and dragged down:
=IFERROR(INDEX($C:$C,MATCH($A1,$B:$B,0)),"")
MATCH($A1,$B:$B,0) will return the row number that the date appears in in column B.
INDEX($C:C$,....) will return the value from column C based on the row number returned by the MATCH function.
If nothing is found then an #N/A error occurs which is dealt with by the IFERROR(.....,"") function.
I have a spreadsheet that looks like this:
A B C D
------------------------------------
1 | Yes | No | | | |
2 | 1 | 1 | 0 | 1 | 0 |
------------------------------------
------------------------------------
12| Yes | No | | Yes | Yes |
13| Yes | Yes | No | No | |
14| Yes | No | | No | Yes |
15| No | Yes | No | No | |
...
I want to fill the cells in Row 2 with a 1 or 0 depending on several criteria. The value should be 1 if all of the following are met (using cell D2 as a reference):
All previous values in Row 1 should match at least one entry in the table starting at D12. For cell D2, this means A1:C1 should exactly match columns A:C in at least one row of the table.
For any of the matching rows from #1, there should be a non-empty value in the same column as the cell being evaluated. So cell D2 would look for a non-empty value in Column D of any rows that match the criteria in #1.
If either of these conditions fails, the cell value should be 0. In Cell D2 we have a value of 1 because the algorithm finds a match in rows 12 and 14 and a non-empty cell in D12 and D14.
I'll need to be able to apply this dynamically across several columns so I'm trying to avoid writing a column-specific function. I realize I could probably write a UDF to perform this, but I wanted to avoid going that route if possible.
Because this was a challenge I had a go at it and came up with
=SIGN(SUM(--(MMULT(($A1:A1=$A12:A15)*(B12:B15<>""),TRANSPOSE(COLUMN($A12:A15)^0))=COLUMNS($A1:A1))))
to be entered in B2 and pulled across. This has to be entered as an array formula using CtrlShiftEnter
A2 I think is just
=sign(counta(a12:a15))
because it will be 1 unless the whole column is empty.
I'm not sure there's a complete answer to your problem as stated without a UDF, but I'd question the method a bit and say "why complicate with 'AND this column isn't blank (but could be any other value)?"
Why not just look for a row match from that field backward? Seems to me it would just shift things by a column, and in fact, this is exactly what you're doing in A2 anyway, since there's nothing before A. So matching on duplicate rows for example, D2 would contain basically the same information as your example has in C2.
To look for duplicates across fields, you could use something like this formula that would go in C2: =IF(SUMPRODUCT((A3:A15=A1)*1,(B3:B15=B1)*1,(C3:C15=C1)*1)>1,1,0)
In D2, you'd copy that formula and add (D3:D15=D1)*1, etc.
I have Sheet1 Sheet2.
EG, in Sheet1 I have
|Column A|Column B|Column C|Column D|Column E|Column F|Column G|
|1001 |Step 1 |ID1 |--- |--- |--- |--- |
|1002 |Step 2 |ID2 | | | | |
|1003 |Step 3 |ID3 | | | | |
In Sheet2 I have
|Column A|
|ID1 |
|ID2 |
|ID3 |
I need to export all values from Sheet1 where the values in Column C matches values in Column A in Sheet2, and also filtering out a set of values in Column A. In Column A, there are six different values that must match individually, but also two values that must match together, EG 1001 OR 1002 OR (1001 AND 1003).
All values matching those criterias should then be exported to another sheet, and if possible, insert a certain value in Column E (same value in all rows).
Is this possible, and how? Also, if my question is unclear, I'll try to specify what I mean in a better way.
How I solved this:
=+VLOOKUP(C1;'Sheet2'!A:C;2;FALSE) - to check that the IDs in Sheet1 Column C matches IDs in Sheet2 Column A.
Another VLOOKUP for the values in Column A - I made another sheet with the values that had to match these.
I also made a Pivot table to crosscheck the data.
I've 2 columns A and B. A contains names and B contains the count of those names till that record as shown below.
-----------------------------------
| A | B |
-----------------------------------
1 | Fruits | 1 |
2 | Flowers | 1 |
3 | Fruits | 2 |
So, want to have a formula for this. Expecting an array formula. Even if an array formula is not possible, a general formula
Attached a spreadsheet so that it can be explained better.
https://docs.google.com/spreadsheets/d/1wlWqdFwgv90s50iP-bXXBHciyualohj610qFiSatcmQ/edit#gid=1997586177
You do not need an array formula, and I would avoid them when possible. You can accomplish your task with
=COUNTIF(A$1:A1,A1)
Where A1 if the first value in the column of values you want to count. The $ allows you to anchor the top of your COUNTIF range while leaving the bottom dynamic.
In a google spreadsheet you may want to try:
=ArrayFormula(iferror(SORT(ROW(A1:A),SORT(ROW(A1:A),A1:A,1),1)-MATCH(A1:A,SORT(A1:A),0)-ROW()+2))
Example sheet