Called up Levi/Yisrael in place of Kohen and a Kohen then entered:
If there was no Kohen in Shul and a Levi or Yisrael was called up in his place, and then a Kohen entered, whether or not the Levi/Yisrael is to step down is dependent on whether the blessing was already begun:
Levi/Yisrael already began Bracha: If the Kohen entered the Shul only after the [Levi or] Yisrael already said [Hashem’s name, Baruch Ata Hashem, in] the blessing [of Asher Bachar Banu], then the Levi/Yisrael is to continue and finish the Aliyah. [This Aliyah counts as one of the 3/7 required Aliyos and the Kohen is not called up at all, not for that Aliyah or the subsequent Aliyas. One is to continue the remaining Aliyas in the same order followed as when there is no Kohen in the room.]
Levi/Yisrael did not yet begin Bracha: If the Levi or Yisrael did not yet say Hashem’s name in the blessing of Asher Bachar Banu, then the Levi/Yisrael is to stop and the Kohen is to be called up [by name] in his stead. This applies even if the Levi/Yisrael already said Barchu, so long as he did not yet say the words Baruch Ata Hashem of the blessing of Asher Bachar Banu. In such a case that the Kohen replaced the Levi/Yisrael, the Yisrael is to remain by the Bimah until after the Aliyos of Kohen/Levi and receive one of the subsequent Aliyahs [and if he is a Levi then he is to receive the Aliyah of Levi]. [The Yisrael/Levi is to be called up a second time by name for a subsequent Aliyah. Even in the event that the Levi/Yisrael already said Barchu, nevertheless, the Kohen is to repeat Barchu. Likewise, when the Levi/Yisrael receives one of the subsequent Aliyois, he is to recite Barchu again.]
What is the law if in truth there was a Kohen in Shul and one only realized after the Levi/Yisrael was called up?
In a case that the Levi/Yisrael had to step down, must the Levi/Yisrael receive one of the coming Aliya’s or is it optional?
What is to be done if there was no Levi in Shul and the Kohen was called up for Kohen and Levi, and a Levi then walked in?
 Michaber 135/6; Mahariy, in name of Orchos Chaim, in name of Rif
 M”A 1235/8; M”B 135/19; Kaf Hachaim 135/36
 The reason: As otherwise the blessing would be in vain, and thus it is better that he complete the blessing and receive the Aliyah then have the Kohen take him over and cause the blessing to be said in vain. [M”B 135/19; Machatzis Hashekel 135/8]
Saying Lamdeini Chukecha: Even if he stopped and realized by the Words Baruch Ata Hashem that the Kohen entered, he is not to conclude with the words Lamdeini Chukecha, hence saving the blessing from being in vain and allowing the Kohen to step up in his place. Rather he is to finish the blessing as usual. [M”A 135/8 in implication of Michaber ibid; Elya Raba 135/7; Chaye Adam 31/20; Kaf Hachaim 135/35; See Beir Moshe 3/18] The reason for this is because, the ability to fix a blessing by saying Lamdeini Chukecha [as brought in Michaber 206/6] is not according to all opinions, and hence initially it is best to say the blessing properly. [Machatzis Hashekel ibid]
 P”M 135 A”A 8; M”B 135/20; See Q&A!
The reason: As since the Levi/Yisroel received the Aliyah according to law [as the Kohen was not in the room] therefore it counts as part of the 3/7 required Aliyos. Furthermore, one cannot call up the Kohen for a subsequent Aliyah, as this will make people think that the Kohen is in truth not a Kohen, as he was called up for the Aliyah of Levi/Yisrael, and he is hence not to be called up at all. [See P”M 135 A”A 8]
 The reason: As the mere saying of Barchu is not considered in vain if he does not continue with the blessing, as the congregation already replied Barchu Es Hashem Hamevorach to his Barchu. [Levush 135; Machatzis Hashekel 135/8; M”B 135/21 in name of Gr”a; ; Kaf Hachaim 135/36-37 in name of Shut Hageonim]
If the Kohen entered in middle of the Yisarel saying Barchu: In such a case, if the Yisrael already said Hashem’s name, he is to conclude “Hamevorach” and have the congregation answer after him, and then step down for the Kohen to take his place. [Kaf Hachaim 135/37]
 The reason: This is done in order not to embarrass the Levi/Yisrael and make them step down without an Aliyah. [M”A 135/9; Chaye Adam 31/20; M”B 135/22; Kaf Hachaim 135/38]
 There are various reasons mentioned behind why we call up the person by name [See Poskim in Piskeiy teshuvos 139/2], and hence although he was mistakenly called up once, nevertheless, seemingly when he is called up anew he is once again to be called up by name. Vetzaruch Iyun
 Elya Raba 140; P”M 140; Derech Hachaim 2; Kitzur SHU”A 23/12; M”B 135/21; Kaf Hachaim 135/39
Other opinions: Some Poskim rule the Kohen is not to repeat the saying of Barchu. [Pesach Hadvir, brought in Kaf Hachaim 135/39; See Poskim in Piskeiy Teshuvos 135/15 footnote 92-93]
 Kaf Hachaim 135/39
 P”M 135 A”A 8; Noda Beyehuda Tinyana 14; Yosef Ometz 9; Ikarei Hadat 6/1; Mamar Mordechai 135/7; Shaareiy Efraim 1/25; M”B 135/20; Kaf Hachaim 135/34
Other opinions: Some Poskim rule that only in a case that the Kohen was not in Shul when the Yisrael began the blessing do we say that the Yisrael was Yotzei the Aliyah as part of the 3/7 required Aliyos and it is not necessary for the Kohen to be called up. However, if the Kohen was in Shul and accidently was not called up, then the Yisrael does not fulfill that Aliyah as part of the 3/7 required Aliyos, and the Kohen must be called up for Levi and another seven called up after him. [Peri Chadash 135/6, brought in Poskim ibid; See also Beir Moshe 3/18] The above Poskim ibid negate this opinion and rule the Aliyah counts as part of the 3/7 required Aliyos and the Kohen is not to be called up at all.
 The reason: The reason the Kohen is not to receive an Aliyah is because this will make people think that the Kohen is in truth not a Kohen, as he was called up for the Aliyah of Levi/Yisrael, and he is hence not to be called up at all. [Poskim ibid]
 Makor Chaim 135; Aruch Hashulchan 135/15
 Piskeiy Teshuvos 135/15