Forum Discussion
Deleted
Jan 20, 2021Macro that concatenates two cells, references a Date and then copy pastes value into first
Would love some help writing this macro i tried attaching a file with more explanations within the file if it helps make it clearer. (in yellow highlights & red text) I have two sheets. One tit...
mathetes
Jan 21, 2021Silver Contributor
Deleted
Some thoughts in response to what you wrote (which I'll quote in italics)
yeah, i also downloaded Money to see if i could try to come to my solution from that, but that didn't work out. i'll be making use of it down the road though.
I was disappointed in Money in Excel on several points. First, because my bank and stock accounts at Fidelity are all behind dual factor authentication, MiE could not get that data. I had gotten all the credit card data before trying..... But from a sheer design point of view, their budget categories seemed to have been very poorly conceived, and there was only a limited amount of flexibility in modifying them.
part of the reason why i wanted to take this route is because it helps me learn. i'm not too advanced with excel, but i marvel at its power.
Keep at it. You're right about its power. I would just recommend learning to do as much as you can without reverting to macros. The built-in functions are many and varied. Learn to take advantage of them to sort through data. Learn to create tables that reference one another by means of functions like XLOOKUP, INDEX, MATCH, and the like. If you're in the Windows environment, learn Power Query.
Macros are good for recording repetitive actions, and, yes, you might also be able to do some data manipulation. But often I suspect you'll learn later that the data manipulation you can do with a macro is better done, more reliably and faster, with a built in function.
An anecdote to illustrate my point. Years ago (decades ago) I was in charge of the HR database for a major corporation. We had to do a monthly headcount report, summarizing employee counts by division, location, employee category, etc., etc. One of the programmers in IT had written a massive macro that produced the spreadsheet report. It took about 30 minutes to run. I spent some time using nothing but built-in functions and was able to produce accurate results in a small fraction of the time, more reliably. That programmer was simply using the skills she knew and assumed would be more powerful, more suited to the task since it required going through so many records.
That was all on Lotus 1-2-3 and happened in the 1990s..... Excel now is far more powerful than Lotus was then. The data you're working with is far less complicated than what we were working with in tracking transfers, hires, terminations across many thousands of employees. I am suggesting that if you learn how to create well-designed Tables of your transactional data you won't need macros.
FWIW, I have one large workbook that tracks our income and expenses, drawing on data from four credit card companies and three bank accounts. I also have a couple spreadsheets to track investments, one of which is devoted to options trades. No macros are used in any of them. Only built-in functions and tools like Pivot Table. Speaking of which,
i also thought about using a pivot table but as an absolute last resort. i'm hoping it doesn't get to that point.
Why "as an absolute last resort"? You write as if it's a very bitter pill, an unpleasant task to be avoided at all costs. Most people, when they discover how easily it can produce useful cross-tabulated summaries of such things as expenses, are delighted. There's a small learning curve, but it's really small. And well worth delving into. Here: this is a website that does a great job of explaining not only the Pivot Table, but many other built-in functions. https://exceljet.net/excel-pivot-tables
I highly recommend that site (and there are others) as something you can make use of in your learning. YouTube also has some excellent videos, some of them by people you'll encounter on these pages.
Deleted
Jan 23, 2021thanks mathetes
the main reason for not using pivot tables here is because it wouldn't match the aesthetics i laid out.
however, it doesn't looks like i can accomplish what i'm trying for without using them in place of (at least to my knowledge)
i tried writing out what the formulas would do, but i can't get around it
is it possible to have a formula that does this:
if column N from 'Data' sheet equals the same month as today, then concatenate columns N & O from 'Data' sheet
but with that, it would have to do this search through all of column N without picking the same row twice
i think i might be able to manage from there
- JMB17Jan 23, 2021Bronze Contributor
Deleted
I added a formula to column L of the data tab to concatenate the month/day for today's month as an example of one way I believe what you're asking can be done.
- DeletedJan 23, 2021
wow, thanks JMB17 . beautiful formula.
thanks as well mathetes. for this column i'll probably end up keeping the format as '00 - 00' but i can use the knowledge from your formula as well.
now, i wanted to see if it was possible to have a formula that would list out all the dates that fall in the same month as Today. i figure from there i should be able to finish up this section with index/match.
i'm trying to toy around with the below formulas, but i'm getting either #Value, #Calc or #Spill errors.
is this possible, or am i spinning my wheels?
=FILTER(Data!P:P,VALUE(LEFT(Data!M:M,2)=MONTH(TODAY())))
=FILTER(Data!P:P,LEFT(Data!M:M,2)=MONTH(TODAY()))
=FILTER(Data!P:P,MONTH(Data!M:M=MONTH(TODAY())))
- mathetesJan 23, 2021Silver Contributor
Deleted
As I've said before, I'm mystified by how you're approaching this, unable to figure out the goal.
I can, nevertheless, tell you that the SPILL error with FILTER means something is blocking the function from delivering all the results, not that there's something wrong with the formula. After trying to delete rows and columns adjacent to your own formula, I took your formula and copied it over to a new sheet--you can see the result here.
Clearly some more refinement is needed to the criteria to be applied in the FILTER function.
- mathetesJan 23, 2021Silver Contributor
I took the formula that JMB17 had written and modified it so that the result of the formula is actually a full date in Excel's date format. As you'll see, the condition in the first part of the IF function remains the same, but the rest, in my version, no longer uses concatenation; rather it uses the DATE function to take the numbers of day, month, and year, to produce the standard numeric value that the date format then turns into a date. This is then consistent with your dates for holidays, paydays, etc.
Here's the new formula, as it appears in cell L2.
=IF(OR(N2=MONTH(TODAY()),N2="xx"),DATE(YEAR(TODAY()),MONTH(TODAY()),O2),"")
I still have to say, however, that it's not clear to me what you're doing with the rest of the workbook. But if you can make this work, go for it.