Count colored cells with a VBA function and output number of hits? - vba

I have a simple time schedule sheet that we use to keep track of who is working when. It is simple a set of cells covering 24h, where each cell is representing 15 minutes.
There all kan mark when they have worked during the day by just fillng the cells with "their" color.
We have up to four ppl working every day, and I wan't to have an automatic summary of the number of hour they've worked everyday. Right now I have a separate column for each emplyee and besid every day, where I manually fill in the time, but I would like to have this done automatically whenever day fill in their color.
Is that even possible? Anyone got any hints on this to help me forward?
Thanks in advance,
Hmb

Thanks for the link to the other thread here at stackoverflow, must have missed it when I tried to look for an answer.
I also found a premade library with coloring functions and alot of explanations about how to use (and not) color-functions in Excel.
http://www.cpearson.com/excel/Colors.aspx
After trying it out I got it all working, and now have a sheet that automatically calculate the times for every person from they colored cells! :)
/Hmb

Related

Formatting Cells to highlight after a specific time period has elapsed

I am trying to resolve an issue regarding my workplace in google sheets. I am looking to highlight cells in a specific column after a specific time has elapsed. This column is going to consist of time stamps. What I am trying to do is once 15 minutes of the cell's timestamp to highlight it red as a notifier for the user of the sheet to proceed with a process. There is no way to do this with normal Conditional formatting and look clean. I am not sure as to where to start other than I can basically do this by making a script using Google Sheets script editor. I just need a push in the direction.
I have looked into normal Conditional Formatting built into Google Sheets and it can be done but you would have an End Time Column basically incremented 15 minutes after the original time stamp using the today() formula. However this is cluttered and ideally isn't as seemless I would like it to be.
I am looking to write a script to automatically highlight the timestamp red once the current time is at least 15 minutes or older. Without the end column it doesn't work and ultimately I am trying to keep from having extra columns when they are not needed. I am not sure where to start. Just looking for opinions on how to start this.

index match second value

Okay so, i've created a spreadsheet to learn and develop the things i need.
i've done so much, then got stuck.
i have a value i'm trying to index match, the first works, but i can't get the second value no matter what i do.
the first cell contains this formula:
=IF(ISERROR(INDEX(A2:R4,SMALL(IF(A2:A4=A11,ROW(A2:A4)),ROW(1:1)),11)),"NOPE",INDEX(A2:R4,SMALL(IF(A2:A4=A11,ROW(A2:A4)),ROW(1:1)),11))
with ctlr shift enter to create the array.
the second contains:
=IF(ISERROR(INDEX(A2:R4,SMALL(IF(A2:A4=A11,ROW(A2:A4)),ROW(2:2)),11)),"NOPE",INDEX(A2:R4,SMALL(IF(A2:A4=A11,ROW(A2:A4)),ROW(2:2)),11))
I HAVE DUPLICATE VALUES I'VE CHECKED 1000 TIMES.
I've only posted here once before and i got told to google etc, and i have done that till my fingers hurt but i can't get this to work.
any suggestions
the second should show the 2nd result row(2:2) but i get an N/A result, or NOPE as in my formula. so i have two duplicate values and i want the results from column number 11. the first formula provides the first result, i'm trying to obtain the second. they are close to identical, with the exception of the row (the two formulas that is). i'm still new so i apologise if this doesn't make to much sense, googled most of my excel and sql life.
=IF(ISERROR(INDEX(A2:R4,SMALL(IF(A2:A4=A11,ROW(A2:A4)),ROW(2:2))-1,11)),"NOPE",INDEX(A2:R4,SMALL(IF(A2:A4=A11,ROW(A2:A4)),ROW(2:2))-1,11))
I figured it out, hours and hours, probably due to league of legends and vodka interrupting. the above worked for me. thank the heavens.
I hope this might help others also.

VBA challenge: Spent a while with VBA, just messing this up more

So I'm in a rush to put together an excel file for something quick and dirty at work. I've spent several days learning VBA / macros and have learned many individual pieces needed for this, but putting them all together is just not working how I'm looking for.
So I'm taking something similar to the following table of data and trying to reorganize it:
(I can't post the image bc of rep)
![Sample Data Table] https://imgur.com/a/FrwEp
Data in columns d-f are all a list of stuff. What I want to do is start with the first date in column D, find the range of where it fits in column a and copy the data there. For an expense report for example - e1:f1 data would get copied over to b1:c1 since it corresponds with that as the date range. In a nutshell, dates in column A are income dates. They are set to pay all items listed on the right scheduled to be paid before the next pay date. See the finished example here:
![Final Sample Data Table] https://imgur.com/a/niaqB
How might you throw this together to make it work. I'm looking for simplicity as I'm gonna have to heavily modify it to what its actually being applied to.
Sorry for the weird post, this is my first time creating a post myself :)
A handy way to get started with VBA is to record a macro of the actions you need to duplicate, and then analyze the macro's generated VBA code, line by line, revising the code to fit your needs.
(Also: Using Comparison Operators in VBA)

Merging cells horizontally across twelve columns

I am trying to merge cells horizontally, and I understand it can't be done dynamically by expression, so I'm looking for suggestions on a possible alternative way to accomplish it. I have 3 columns of data and then the next 12 columns are months. They enter the start month and then it's a rolling twelve month display. The user want's the top row of the heading to be the year, but merged. The second row of the heading is the month name. I've suggested to the user the easy task of merging after the export, but she also wants it exported to PPT and be ready to publish without modification. Any ideas?
enter image description here
This may seem like pretty simple stuff to you veterans, but I'm new to SQL and SSRS. So, to answer my own question, I ended up creating 12 rows that I can make visible according to the starting month of the rolling 12 months. I wasn't sure how that would work, but it is working great and I now have a foundation if I ever need it again.

Pull data from multiple Excel sheets, count how many of a certain lead within a month

A continuation of a previous question... where I have run into another formula issue.
We have an Excel spreadsheet where we track our leads. My boss wants to know, specifically "how many leads for each month and how many of each source and the result."
The users on this forum were incredibly helpful, and gtwebb gave me this formula (thank you!):
=COUNTIF(Sheet1!A14:A21,12012)
Which worked beautifully for counting how many leads we had in each month.
Now I need to know how many leads came from the Web, SOI, VP/Sign, etc., WITHIN that month. So I'm hoping there is a formula where I can ask Excel to only look at a certain month, say 12012, and then how many leads we got from the Web or other places. I know I'll need to change our lead source for each formula, but I can't get the basic formula to work. I've tried: =countif(Sheet1!e2:e20,12012, if(Sheet1!m2:m20,Web)), and other variations on this, trying to elaborate on the original formula that worked correctly.
Thank you for your help!
A Pivot Table didn't really ring a bell with me, so I looked into a formula solution.
Pnuts posted a suggestion to try sumifs(). I could only get this to work if there was a column with "1" in it for every line.
A similar function, countifs(), seems to work. Here's a formula for counting the number of lines with a month of "12012" and a source of "Web":
=COUNTIFS(Sheet1!A:A,"=12012",Sheet1!B:B,"=Web")
It assumes that column A is month and column B is source. Good luck!
Your boss wants a Pivot Table made from the data. Unless you have other reasons for using formulas or VBA (not stated in the question), using the pivot table functionality instead will save you a lot of effort in this case.