Consulting

Results 1 to 4 of 4

Thread: Return data from different sheets and variated cells Macro

  1. #1
    VBAX Newbie
    Joined
    Jul 2014
    Posts
    3
    Location

    Return data from different sheets and variated cells Macro

    Hi,

    I need to sum data from several sheets, where the values which should be returned variates. I have a "Total" sheet where I want to summerise forcast from different headers in every sheet in the file. The location of the forcast which should be retured to the sum sheet could be variating depending on how many accounts every header includes on the different sheets. What is consistent is the header which always start on A6 and the value that should be returned (forcast) always start in H6 in each sheet.

    So for exampel "Staff" should be sumerised from all sheet "CC1000", "CC2000", "CC3000":s headers "Staff" into the sheet "Total", in D4. Likewise should all the other headers be summerised.

    Could somebody please help me to find a VBA code in order to solve this?

    I've attached an example, so you could understand my case.Exampel file.xlsx

    Thanks!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Does this do it

    =INDEX('CC1000'!$H:$H,MATCH(Total!$A2,'CC1000'!$A:$A,0))+INDEX('CC2000'!$H: $H,MATCH(Total!$A2,'CC2000'!$A:$A,0))+INDEX('CC3000'!$H:$H,MATCH(Total!$A2, 'CC3000'!$A:$A,0))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Jul 2014
    Posts
    14
    Location
    Should work...

  4. #4
    VBAX Newbie
    Joined
    Jul 2014
    Posts
    3
    Location
    Thanks for the formula, it worked! How about if I have about 20 different sheets and don't want to write a long formula, but I have all Sheet names in F1 and below. Is it possible to use some formula to refer to all different sheet names instead of typing them in?

    Also another question. Sometimes some sheets will not include every header in column A, which mean I'll get "#Value!". Is there any way to solve this?
    Last edited by simpmark; 07-14-2014 at 05:32 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •