I'm trying to count the number of columns that contain some text. So for example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
x x x
xxxxxx xxx
xxxxxxxxxxxxxxxxxxxxxxxxx
Something like that should return "13". Doesn't matter how many cells contain text in the column, all I care about is how many columns contain text. Any suggestions?
While this isn't sophisticated coding or anything, this has worked well for me in the past.
At the top of each column (above the header, somewhere not in the way and that you won't need to use) add a CountA() formula that tells you how many cells in that column are not empty.
Put that inside an IF statement. =If(CountA("YourColumnRange") > 0, 1, 0)
Then, where ever you need it, sum up the results of each of the formulas for those columns and that will give you the total number of columns you are looking for.
If you don't want to display the "1" or "0" at the top of each column, simply change the text color in those cells to match your background (default being to change the text color to white).
Let me know if any of that needs clarification.
Related
Picture 50 rows that all have a number "4" in it.
However in each row there are 26 columns (A-Z) and the 4 is placed on a different letter in each row.
I need a count of finding the "4" in each row (i.e. if it's "E" that the "4" sits in, the count should be "5".
the 1 should be counted as a 5 because the 4 is 5 cells along
Without seeing your column headings, I think you can just use the MATCH function.
=MATCH(4,A1:I1)
Result
You just need to adapt it to your range.
Hate asking question about something as simple as an Excel formula, but seem to really need and would appreciate the help.
I have a table where the rows headings contains names and the column headings contains week numbers. Within this table I have differents numbers. Both numbers that are plus and negatives.
I want to count each cell where the row heading matches a specific name and then each cell that has a plus value with a week number less than or equal to a certain week.
I have tried to got it to work with at least some function (without it caring about plus and negative values) but haven't even gotten that to work.
I've tried with:
=SUMPRODUCT((Data!F3:F28=I1)*(Data!I2:BI2="<="&A1)*(Data!I3:BI28))
=SUMIFS(Data!I3:BI28;Data!F3:F28;I1;Data!I2:BI2;"<="&A1)
.............1 2 3 4 5
name1 -1 4 3 1 1
name2 0 0 0 0 0
I want a formula that counts for example every column header with a value less than or equal to (for example) 4, but excludes negatives and vice versa. So for the example above, the result of name1 should be 8; counts week 2, 3 and 4.
For your current example:
Formula in H3:
=SUMPRODUCT((B2:F3>=0)*(B1:F1<=4)*(A2:A3="name1"),B2:F3)
I have a data like this in excel:
1 1
1 2
2 2
3 2
And I want the result to be displayed like this:
1
1
1
2
2
2
2
3
Its like a ascending sorting. If the number in columnA <= columnB, it will be display first, at the same time, columnB will have a empty cell or blank value.
I have looked for this for a while but no one has the problem like this.
I would prefer a formula rather than VBA code.
Please advise, thanks!
Edit: I hope this explanation will be easier to understand
Data (A1:B2) - Result (C1:D4). Each number in Data (A1:B2) is a result of complicated formula so I cannot change its position
A B C D
1 1 2 1
2 3 4 2
3 3
4 4
Honestly, if you want to avoid VBA, here's a manual process that would give you the results you want:
Color each column (ie. Column A Red and Column B Blue)
Place values of column B under column A
Sort & Filter by Sort Smallest to Largest
Copy the contents of column A to column B
Last for Column A Find and Replace all* with format Blue then do the same for column B only with format Red. (See below for more info on how to do that).
Following those steps isn't the most conventional, but it will give you the results you wanted without VBA.
*Find and Replace based on font color:
1. Press Ctrl-H
2. Click Options
3. Click Format > Font > then select your font color > OK
4. With the Find What blank with the font color and the Replace With blank click Replace All.
Say,I have 2 tables...Tables are related...
1 3 5 7
8 8 9 10
11 12 13 14
&
2 3 5 5
1 1 1 1
3 4 4 4
I have highlighted top 5 values in first table using conditional formatting rules.Now I want to highlight cells in the second table based on first table...Assume 11 12 13 14 7 10 are highlighted in first table....I want to highlight cells in second table occupied same position as of in highlighted cells in first table..i.e. 3 4 4 4 5 1 should be highlighted...How can I do that
Use Excel functions RANK and/or COUNTIF to calculate a sequential ranking list column for the first table. The expression is explained here.
For the second table, you can then use conditional formatting based on the computed rank.
Might just be an elaboration of #Axel's answer and I agree the details of the question do not make sense but the position of a selection of top (or bottom) ranked cells in one array (say A1:D3) can be used to determine whether or not to format a cell in the corresponding position of another array (say H5:K7):
Select from H5 to K7, then HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=RANK(A1,$A$1:$D$3,)<6
Format..., select formatting, OK, OK.
Change the 6 to suit how many cells are to be formatted which for <6 could be more than five if the value ranked fifth is duplicated.
Given a column like this:
Column A
1 4
2 Blank
3 Blank
4 3
5 blank
6 2NDF
7 Blank
8 blank
9 1/2/2014 <-- Date value I need to change to a text value: "1-2"
10 blank
11 5/1/2014 <-- Date value I need to change to a text value: "5-1"
12 blank
...
I need to find a way to programmatically change each cell that contains a date value like in rows 9 and 11 into a text value the equivalent of the numeric month followed by a dash follwed by a numeric day. I have 24,000 rows. Doing a find and replace is not practical. I cannot change the format of the entire column because rows like 1 and 4 get converted and I don't want those to get converted.
Create a new column B and use the function
=IF(NOT(ISERROR(DATEVALUE(A1))),MONTH(DATEVALUE(A1))&"-"&DAY(DATEVALUE(A1)),A1)
OK, I achieved the result I wanted by splitting out three "if" tests (similar to what Brett suggested) into 3 additional columns. Each column had its separate "if" test and built on the column before it. Here are the if tests:
=IF(N5>40000,MONTH(N5)&"-"&DAY(N5),N5) # sets format I want and skip cells that are low integers and not dates
=IF(O5=0,"",O5) # Sets cells with "0" in them to blank
=IF(ISERROR(P5),N5,P5) # fixes cells that were originally text and that produced errors
Given that in the OP the data seems to be in ColumnA starting in Row1 a single formula such as:
=IF(OR(A1<40000,ISTEXT(A1)),A1,MONTH(A1)&"-"&DAY(A1))
and copied down would seem adequate.