Omega Owners Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to OOF

Pages: 1 2 3 [All]   Go Down

Author Topic: Any MS Excel experts in here?  (Read 2431 times)

0 Members and 1 Guest are viewing this topic.

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Any MS Excel experts in here?
« on: 25 June 2014, 17:48:38 »

Bloody Excel, office tosser's tool. I'm rubbish at it. But the managers want their pretty pictures

Have a Worksheet with Date, Name, Type and a Yes/No columns.  To make it easier to clarify, lets pretend its OOF, and what sections current and future mods visit - so my worksheet may look like:

DATE    Name         Section      ActionDone
1/4/14 KevinWood  GenChat    Yes
6/4/14 TheBoy        GenChat   No
6/4/14 TheBoy        FAQ          No
8/4/14 MDTM          Newbie     Yes
9/4/14 Hotel21        Newbie     No
21/4/14 TheBoy      CarChat     Yes
5/5/14 Hotel21       GenChat     Yes
5/5/14 AA              GenChat     No


You get the idea :)

From this, I need to create the following columns:
Name
Number of times name appears
Number of times name appears with Action=Yes
Number of time name appears in last 30 days
Number of time name appears in last 30 days with Action=Yes

(I'll prob need to add additional time options). From this, I should be able to create the pretty graphs that mgmt will drowl over, but ultimately ignore what its telling them.

TIA for any pointers.
Logged
Grumpy old man

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #1 on: 25 June 2014, 17:51:49 »

I'll add, I've currently got the names and type cells built as dropdowns from a Named List on another worksheet, so a) its consistent (but adjustable), and b) may be easier to use to build and calculations?
Logged
Grumpy old man

tunnie

  • Get A Life!!
  • *****
  • Offline Offline
  • Gender: Male
  • Surrey
  • Posts: 37522
    • Zafira Tourer & BMW 435i
    • View Profile
Re: Any MS Excel experts in here?
« Reply #2 on: 25 June 2014, 17:52:59 »

Use Frequency?  Done similar, recall basic freq wizard did the job :-\
Logged

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #3 on: 25 June 2014, 17:53:23 »

Can you fire SQL commands into Excel - this has to be a standalone Workbook, not linking to any other files.

I could do it in SQL commands :)
Logged
Grumpy old man

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #4 on: 25 June 2014, 17:54:41 »

Use Frequency?  Done similar, recall basic freq wizard did the job :-\
There was some issue around doing the dates when I played earlier today, then I got sidetracked onto Pivot Tables, and lost 3 hours of my life without achieving anything useful.
Logged
Grumpy old man

Bigron

  • Omega Baron
  • *****
  • Offline Offline
  • Gender: Male
  • Witham, Essex
  • Posts: 4808
    • Omega 2.6 V6 Auto '51 Reg
    • View Profile
Re: Any MS Excel experts in here?
« Reply #5 on: 25 June 2014, 18:01:28 »

TB, can you tell me exactly what data you are needing to process, if it doesn't breach Company Confidentiality?
Excel and I are old enemies, with which I have battled often and won sometimes!
If you are able to send me the raw data I will do battle on your behalf and may even be able to end up with a pretty chart? 8)
It would please me to be able to repay some of the great things OOF have done for me, as another member posted earlier.

Ron.
Logged

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #6 on: 25 June 2014, 18:12:12 »

Its confidential, but the example above should give the idea...
Logged
Grumpy old man

jimbobmccoy

  • Intermediate Member
  • ***
  • Offline Offline
  • Gender: Male
  • outer london
  • Posts: 311
    • View Profile
Re: Any MS Excel experts in here?
« Reply #7 on: 25 June 2014, 19:14:58 »

Sounds like the countif function is what you need.

Essentially counts number of times a value appears in a range if it meets your criteria.

I'll have a proper look a bit latter if still  needed.

Alternatively-script a query to import the excel in to a SQL DB on a schedule, then update the needed columns that exist in the table with the info you need and push out to csv, again scheduled.

You can then just set a macro to run text to columns, save as xls, and you're done.
Completely arse about face, but as I generally detest excel, it's stupid language and lack of ability to do what SQL does, I have done this before. (Albeit on a more complex requirement) (and yes, I'm choosing to completely ignore excel is not meant to be access, SQL or any other form of DB :y)
Logged

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #8 on: 25 June 2014, 19:18:20 »

Importing into a DB is a no-go I'm afraid. That was the way I wanted to go.
Logged
Grumpy old man

cem_devecioglu

  • Guest
Re: Any MS Excel experts in here?
« Reply #9 on: 25 June 2014, 19:26:46 »

I'n not an excel expert ,  but  you can use visual basic macros in excel .please have a look at this page  :y


http://www.excel-easy.com/vba/workbook-worksheet-object.html


and this one
http://www.excel-vba.com/vba-prog-1-1-editor.htm


main page
http://www.excel-vba.com/excel-vba-contents.htm


ps: I would also transport it into sql  ;D



« Last Edit: 25 June 2014, 19:28:49 by cem »
Logged

Gaffers

  • Omega Queen
  • *****
  • Offline Offline
  • Gender: Male
  • NE Hampshire/Surrey
  • Posts: 11322
    • Ford Ranger Wildtrak
    • View Profile
Re: Any MS Excel experts in here?
« Reply #10 on: 25 June 2014, 19:28:09 »

You need to use the COUNTIF function :y

http://office.microsoft.com/en-001/excel-help/count-how-often-a-value-occurs-HP001127779.aspx

Edit:  you can nest the COUNTIFs with IF statements as required
« Last Edit: 25 June 2014, 19:30:01 by Monsieur Guffer »
Logged

cem_devecioglu

  • Guest
Re: Any MS Excel experts in here?
« Reply #11 on: 25 June 2014, 19:30:16 »

also within usual vb, you can create excel object ,  open the excel sheet and work with columns like any variable :y


just add the excel object class from objects/references then
Dim xl As New Excel.Application
Dim xlsheet As Excel.Worksheet
Dim xlwbook As Excel.Workbook
Private Sub Command1_Click()
Text1.Text = xlsheet.Cells(2, 1)
Text2.Text = xlsheet.Cells(2, 2)
xl.ActiveWorkbook.Close False, "c:\book1.xls"

xl.Quit
End Sub
Private Sub Command2_Click()
xlsheet.Cells(2, 1) = Text1.Text
xlsheet.Cells(2, 2) = Text2.Text
xlwbook.Save
xl.ActiveWorkbook.Close False, "c:\book1.xls"
xl.Quit
End Sub
Private Sub Form_Load()
Set xlwbook = xl.Workbooks.Open("c:\book1.xls")
Set xlsheet = xlwbook.Sheets.Item(1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set xlwbook = Nothing
Set xl = Nothing
End Sub
« Last Edit: 25 June 2014, 19:37:33 by cem »
Logged

jimbobmccoy

  • Intermediate Member
  • ***
  • Offline Offline
  • Gender: Male
  • outer london
  • Posts: 311
    • View Profile
Re: Any MS Excel experts in here?
« Reply #12 on: 25 June 2014, 19:31:19 »

Also, you may need the IF function, the countifs function and possibly nested IF's.
You can also use a countif as your true or false part of the if function.

So you could say, if my cell has value x then count how many yes's and if it doesn't return text "no value.

The thing to remember-it's excel so is almost always the opposite logic or natural inclination to SQL. And it's designed to screw with any sane persons brain
 :D
Logged

jimbobmccoy

  • Intermediate Member
  • ***
  • Offline Offline
  • Gender: Male
  • outer london
  • Posts: 311
    • View Profile
Re: Any MS Excel experts in here?
« Reply #13 on: 25 June 2014, 19:32:55 »

You need to use the COUNTIF function :y

http://office.microsoft.com/en-001/excel-help/count-how-often-a-value-occurs-HP001127779.aspx

Edit:  you can nest the COUNTIFs with IF statements as required

I Must type faster!
Logged

jimbobmccoy

  • Intermediate Member
  • ***
  • Offline Offline
  • Gender: Male
  • outer london
  • Posts: 311
    • View Profile
Re: Any MS Excel experts in here?
« Reply #14 on: 25 June 2014, 19:35:06 »

Importing into a DB is a no-go I'm afraid. That was the way I wanted to go.

Can you not stick sqlexpress on your own machine, create a one table DB and do it locally on that?

Will anyone mind as long as the output is right?

Also, from experience, management tend to want this type of report to grow-get more complex, analyse the same thing more times, and still not get what it's telling them. As this happens having the info in a proper DB would be a huge help
Logged

Andy H

  • Omega Lord
  • *****
  • Offline Offline
  • Gender: Male
  • Auckland
  • Posts: 5499
    • Mazda MPV
    • View Profile
Re: Any MS Excel experts in here?
« Reply #15 on: 25 June 2014, 19:36:30 »

Use Frequency?  Done similar, recall basic freq wizard did the job :-\
There was some issue around doing the dates when I played earlier today, then I got sidetracked onto Pivot Tables, and lost 3 hours of my life without achieving anything useful.
Been there. :( 2 years of hourly readings from the heat meters in a block of 90 flats.

I did manage to get some answers but it wasn't pretty.

I considered saving all the data in a csv file and writing something to suck it all into a mysql or sqlite database but never got around to it.
Logged
"Deja Moo - The feeling that you've heard this bull somewhere before."

Gaffers

  • Omega Queen
  • *****
  • Offline Offline
  • Gender: Male
  • NE Hampshire/Surrey
  • Posts: 11322
    • Ford Ranger Wildtrak
    • View Profile
Re: Any MS Excel experts in here?
« Reply #16 on: 25 June 2014, 19:37:43 »

You need to use the COUNTIF function :y

http://office.microsoft.com/en-001/excel-help/count-how-often-a-value-occurs-HP001127779.aspx

Edit:  you can nest the COUNTIFs with IF statements as required

I Must type faster!

 ;D

I may or may not have spent a whole year in my yoof doing nothing but excel and VBA  ::)  (which is the most convoluted way to go about this problem)
Logged

cem_devecioglu

  • Guest
Re: Any MS Excel experts in here?
« Reply #17 on: 25 June 2014, 19:39:16 »

on complex scenarios using excel built in functions will get more complicated :-\
Logged

Gaffers

  • Omega Queen
  • *****
  • Offline Offline
  • Gender: Male
  • NE Hampshire/Surrey
  • Posts: 11322
    • Ford Ranger Wildtrak
    • View Profile
Re: Any MS Excel experts in here?
« Reply #18 on: 25 June 2014, 20:06:59 »

on complex scenarios using excel built in functions will get more complicated :-\

True, but this is not complicated for Excel.  In fact it is exactly what is was designed for?
Logged

jimbobmccoy

  • Intermediate Member
  • ***
  • Offline Offline
  • Gender: Male
  • outer london
  • Posts: 311
    • View Profile
Re: Any MS Excel experts in here?
« Reply #19 on: 25 June 2014, 20:18:30 »

You need to use the COUNTIF function :y

http://office.microsoft.com/en-001/excel-help/count-how-often-a-value-occurs-HP001127779.aspx

Edit:  you can nest the COUNTIFs with IF statements as required

I Must type faster!

 ;D

I may or may not have spent a whole year in my yoof doing nothing but excel and VBA  ::)  (which is the most convoluted way to go about this problem)

I'm currently being tormented by reports for work that are a combo of excel, VBA and tying it together with macro scheduler to achieve some level of automation. Convoluted isn't the half of it!
I try to convince myself it's all good for my 'personal development' but when 64bit excel just decides to stop liking existing VB, it's testing. (Apparently a known issue and why Microsoft recommend using the 32 bit version unless absolutely necessary ???)
Logged

Gaffers

  • Omega Queen
  • *****
  • Offline Offline
  • Gender: Male
  • NE Hampshire/Surrey
  • Posts: 11322
    • Ford Ranger Wildtrak
    • View Profile
Re: Any MS Excel experts in here?
« Reply #20 on: 25 June 2014, 20:33:20 »

Ok, because I am a nice chap, here we go :y

Number of times name appears - =COUNTIF(C2:C16, "matt")  where C2:C16 is the range of cells and "matt" is the name
Number of times name appears with Action=Yes - =SUMPRODUCT(--(C2:C16="matt"),--(D2:D16="yes"))
Number of time name appears in last 30 days - =SUMPRODUCT(--(C2:C16="matt"),--(E2:E16<(TODAY()-30)))
Number of time name appears in last 30 days with Action=Yes =SUMPRODUCT(--(C2:C16="matt"),--(D2:D16="yes"),--(E2:E16<(TODAY()-30)))

Logged

Gaffers

  • Omega Queen
  • *****
  • Offline Offline
  • Gender: Male
  • NE Hampshire/Surrey
  • Posts: 11322
    • Ford Ranger Wildtrak
    • View Profile
Re: Any MS Excel experts in here?
« Reply #21 on: 25 June 2014, 20:33:48 »

Now give me a real challenge ::)
Logged

cem_devecioglu

  • Guest
Re: Any MS Excel experts in here?
« Reply #22 on: 25 June 2014, 21:09:47 »

on complex scenarios using excel built in functions will get more complicated :-\

True, but this is not complicated for Excel.  In fact it is exactly what is was designed for?


as the murphy rules says it will always get complicated as time goes by ;D
Logged

cem_devecioglu

  • Guest
Re: Any MS Excel experts in here?
« Reply #23 on: 25 June 2014, 21:10:39 »

Now give me a real challenge ::)


believe me I can :) :y
Logged

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #24 on: 26 June 2014, 17:24:55 »

Importing into a DB is a no-go I'm afraid. That was the way I wanted to go.

Can you not stick sqlexpress on your own machine, create a one table DB and do it locally on that?

Will anyone mind as long as the output is right?

Also, from experience, management tend to want this type of report to grow-get more complex, analyse the same thing more times, and still not get what it's telling them. As this happens having the info in a proper DB would be a huge help
It has to be self contained and independent of anything else. You're preaching to the converted about databases, but that's not an option.

To really add insult, the data has to be updatable via Excel Webapp, as found on whatever Skydrive is called this week, and ShitPoint.

Grrrr
Logged
Grumpy old man

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #25 on: 26 June 2014, 17:27:56 »

Ok, because I am a nice chap, here we go :y

Number of times name appears - =COUNTIF(C2:C16, "matt")  where C2:C16 is the range of cells and "matt" is the name
Number of times name appears with Action=Yes - =SUMPRODUCT(--(C2:C16="matt"),--(D2:D16="yes"))
Number of time name appears in last 30 days - =SUMPRODUCT(--(C2:C16="matt"),--(E2:E16<(TODAY()-30)))
Number of time name appears in last 30 days with Action=Yes =SUMPRODUCT(--(C2:C16="matt"),--(D2:D16="yes"),--(E2:E16<(TODAY()-30)))
I'm failing at a hurdle before - I have a list of names, but this list will change over time, as will the number of names in the list.
Logged
Grumpy old man

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #26 on: 26 June 2014, 17:30:33 »

Instead of ="matt", can I have =NameList!A2 instead, would that resolve it? (assume name was stored in NameList!A2) ?

Then with an IF to ensure that NameList!A2 is valid
Logged
Grumpy old man

Gaffers

  • Omega Queen
  • *****
  • Offline Offline
  • Gender: Male
  • NE Hampshire/Surrey
  • Posts: 11322
    • Ford Ranger Wildtrak
    • View Profile
Re: Any MS Excel experts in here?
« Reply #27 on: 26 June 2014, 18:00:40 »

You can reference a single cell easily, but if you wanted to do a number of names in to one result you would need to add OR statements before the first comma by "matt".  Something like:

=SUMPRODUCT(OR(--(C2:C16="matt"), --(C2:C16="Jimbob")),--(D2:D16="yes"))

For a list of results for different names you would need to do a separate formula for each name you waned to count.  SOmething like this:
=SUMPRODUCT(--(C2:C16="matt"),--(D2:D16="yes"))
=SUMPRODUCT(--(C2:C16="Jimbob"),--(D2:D16="yes"))
Logged

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #28 on: 26 June 2014, 18:23:41 »

I think that gives me a starter to work from :y
Logged
Grumpy old man

Gaffers

  • Omega Queen
  • *****
  • Offline Offline
  • Gender: Male
  • NE Hampshire/Surrey
  • Posts: 11322
    • Ford Ranger Wildtrak
    • View Profile
Re: Any MS Excel experts in here?
« Reply #29 on: 26 June 2014, 18:44:00 »

No probs, the hard part is getting the commas and brackets lined up properly ::)

One tip is to fabric some test data to which you already know the outcome and test your formulas on that :y
Logged

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #30 on: 22 July 2014, 11:36:43 »

Forgot to say thanks, ESP to Guffers, this is now in and working and producing pretty colours for mgmt to pretend they understand.

Thanks !
Logged
Grumpy old man

Gaffers

  • Omega Queen
  • *****
  • Offline Offline
  • Gender: Male
  • NE Hampshire/Surrey
  • Posts: 11322
    • Ford Ranger Wildtrak
    • View Profile
Re: Any MS Excel experts in here?
« Reply #31 on: 22 July 2014, 13:15:22 »

No probs :y

Glad it is working.  I knew that year in France drinking wine and guzzling french food working hard would come in handy one day ;D
Logged

brendan1983

  • Junior Member
  • **
  • Offline Offline
  • Gender: Male
  • Hampshire
  • Posts: 122
    • Omega CDX Saloon
    • View Profile
Re: Any MS Excel experts in here?
« Reply #32 on: 22 July 2014, 13:45:35 »

I didn't see this in June as I was away on my travels... I used to do a lot of work with array formula's in excel - one thing I would say (depending if your data is in a database somewhere) is to do all of this work on the database side, and then just create an external data source to pull the data into excel.

Or what I do a lot of at the moment is to just generate the reports and calculations in reporting services, and they just get sent out on a schedule in what ever format you want.

This type of thing can be a real pain if you end up with lots of spread sheets with data in, much easier to keep it all in a database and just link to it.
Logged
2003 CDX & Yamaha Thunderace

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #33 on: 22 July 2014, 17:31:41 »

I didn't see this in June as I was away on my travels... I used to do a lot of work with array formula's in excel - one thing I would say (depending if your data is in a database somewhere) is to do all of this work on the database side, and then just create an external data source to pull the data into excel.

Or what I do a lot of at the moment is to just generate the reports and calculations in reporting services, and they just get sent out on a schedule in what ever format you want.

This type of thing can be a real pain if you end up with lots of spread sheets with data in, much easier to keep it all in a database and just link to it.
Sadly, we couldn't use a database in this instance, that would have been far too simple and obvious for dim-witted management ;D. It had to use purely Excel, hence my need for help :)
Logged
Grumpy old man

Lagondanet

  • Omega Knight
  • *****
  • Offline Offline
  • Gender: Male
  • Bedfordshire
  • Posts: 1099
  • The Omega is gone!
    • View Profile
    • Lagondanet
Re: Any MS Excel experts in here?
« Reply #34 on: 22 July 2014, 22:53:24 »

The Boy. I have an old 'paper' Excel Users Guide gathering dust on the shelf if you want it, but Version 5.0 (I did say it was old!). I could stick it in the post. Might be useful to start a fire.  ;)
Logged


1980 V8 Lagonda & a 2014 Adam & a 2015 Antara.

TheBoy

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Brackley, Northants
  • Posts: 105924
  • I Like Lockdown
    • Whatever Starts
    • View Profile
Re: Any MS Excel experts in here?
« Reply #35 on: 24 July 2014, 15:45:49 »

The Boy. I have an old 'paper' Excel Users Guide gathering dust on the shelf if you want it, but Version 5.0 (I did say it was old!). I could stick it in the post. Might be useful to start a fire.  ;)
No thanks, I try to avoid the software. Office tosser's tool ;D
Logged
Grumpy old man

Lagondanet

  • Omega Knight
  • *****
  • Offline Offline
  • Gender: Male
  • Bedfordshire
  • Posts: 1099
  • The Omega is gone!
    • View Profile
    • Lagondanet
Re: Any MS Excel experts in here?
« Reply #36 on: 24 July 2014, 21:34:00 »

The Boy. I have an old 'paper' Excel Users Guide gathering dust on the shelf if you want it, but Version 5.0 (I did say it was old!). I could stick it in the post. Might be useful to start a fire.  ;)
No thanks, I try to avoid the software. Office tosser's tool ;D

Noted.
 ;)
Logged


1980 V8 Lagonda & a 2014 Adam & a 2015 Antara.
Pages: 1 2 3 [All]   Go Up
 

Page created in 0.036 seconds with 21 queries.